File: | mat/impls/aij/seq/aij.c |
Warning: | line 24, column 14 Division by zero |
[?] Use j/k keys for keyboard navigation
1 | ||||
2 | /* | |||
3 | Defines the basic matrix operations for the AIJ (compressed row) | |||
4 | matrix storage format. | |||
5 | */ | |||
6 | ||||
7 | ||||
8 | #include <../src/mat/impls/aij/seq/aij.h> /*I "petscmat.h" I*/ | |||
9 | #include <petscblaslapack.h> | |||
10 | #include <petscbt.h> | |||
11 | #include <petsc/private/kernels/blocktranspose.h> | |||
12 | ||||
13 | PetscErrorCode MatSeqAIJSetTypeFromOptions(Mat A) | |||
14 | { | |||
15 | PetscErrorCode ierr; | |||
16 | PetscBool flg; | |||
17 | char type[256]; | |||
18 | ||||
19 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 19; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
20 | ierr = PetscObjectOptionsBegin((PetscObject)A)0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscOptionsObject ->options = ((PetscObject)(PetscObject)A)->options; for (PetscOptionsObject->count=(PetscOptionsPublish?-1:1); PetscOptionsObject ->count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscObjectOptionsBegin_Private(PetscOptionsObject ,(PetscObject)A);do {if (__builtin_expect(!!(_5_ierr),0)) {PetscError (((MPI_Comm)0x44000001),20,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),_5_ierr);}} while (0); | |||
21 | ierr = PetscOptionsFList("-mat_seqaij_type","Matrix SeqAIJ type","MatSeqAIJSetType",MatSeqAIJList,"seqaij",type,256,&flg)PetscOptionsFList_Private(PetscOptionsObject,"-mat_seqaij_type" ,"Matrix SeqAIJ type","MatSeqAIJSetType",MatSeqAIJList,"seqaij" ,type,256,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),21,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
22 | if (flg) { | |||
23 | ierr = MatSeqAIJSetType(A,type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),23,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
24 | } | |||
25 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),_5_ierr);}} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
26 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
27 | } | |||
28 | ||||
29 | PetscErrorCode MatGetColumnNorms_SeqAIJ(Mat A,NormType type,PetscReal *norms) | |||
30 | { | |||
31 | PetscErrorCode ierr; | |||
32 | PetscInt i,m,n; | |||
33 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)A->data; | |||
34 | ||||
35 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 35; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
36 | ierr = MatGetSize(A,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),36,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
37 | ierr = PetscArrayzero(norms,n)PetscMemzero(norms,(n)*sizeof(*(norms)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),37,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
38 | if (type == NORM_2) { | |||
39 | for (i=0; i<aij->i[m]; i++) { | |||
40 | norms[aij->j[i]] += PetscAbsScalar(aij->a[i]*aij->a[i]); | |||
41 | } | |||
42 | } else if (type == NORM_1) { | |||
43 | for (i=0; i<aij->i[m]; i++) { | |||
44 | norms[aij->j[i]] += PetscAbsScalar(aij->a[i]); | |||
45 | } | |||
46 | } else if (type == NORM_INFINITY) { | |||
47 | for (i=0; i<aij->i[m]; i++) { | |||
48 | norms[aij->j[i]] = PetscMax(PetscAbsScalar(aij->a[i]),norms[aij->j[i]])(((PetscAbsScalar(aij->a[i]))<(norms[aij->j[i]])) ? ( norms[aij->j[i]]) : (PetscAbsScalar(aij->a[i]))); | |||
49 | } | |||
50 | } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown NormType")return PetscError(((MPI_Comm)0x44000001),50,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,62,PETSC_ERROR_INITIAL,"Unknown NormType"); | |||
51 | ||||
52 | if (type == NORM_2) { | |||
53 | for (i=0; i<n; i++) norms[i] = PetscSqrtReal(norms[i])sqrt(norms[i]); | |||
54 | } | |||
55 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
56 | } | |||
57 | ||||
58 | PetscErrorCode MatFindOffBlockDiagonalEntries_SeqAIJ(Mat A,IS *is) | |||
59 | { | |||
60 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
61 | PetscInt i,m=A->rmap->n,cnt = 0, bs = A->rmap->bs; | |||
62 | const PetscInt *jj = a->j,*ii = a->i; | |||
63 | PetscInt *rows; | |||
64 | PetscErrorCode ierr; | |||
65 | ||||
66 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 66; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
67 | for (i=0; i<m; i++) { | |||
68 | if ((ii[i] != ii[i+1]) && ((jj[ii[i]] < bs*(i/bs)) || (jj[ii[i+1]-1] > bs*((i+bs)/bs)-1))) { | |||
69 | cnt++; | |||
70 | } | |||
71 | } | |||
72 | ierr = PetscMalloc1(cnt,&rows)PetscMallocA(1,PETSC_FALSE,72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(cnt)*sizeof(**(&rows)),(&rows));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
73 | cnt = 0; | |||
74 | for (i=0; i<m; i++) { | |||
75 | if ((ii[i] != ii[i+1]) && ((jj[ii[i]] < bs*(i/bs)) || (jj[ii[i+1]-1] > bs*((i+bs)/bs)-1))) { | |||
76 | rows[cnt] = i; | |||
77 | cnt++; | |||
78 | } | |||
79 | } | |||
80 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cnt,rows,PETSC_OWN_POINTER,is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
81 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
82 | } | |||
83 | ||||
84 | PetscErrorCode MatFindZeroDiagonals_SeqAIJ_Private(Mat A,PetscInt *nrows,PetscInt **zrows) | |||
85 | { | |||
86 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
87 | const MatScalar *aa = a->a; | |||
88 | PetscInt i,m=A->rmap->n,cnt = 0; | |||
89 | const PetscInt *ii = a->i,*jj = a->j,*diag; | |||
90 | PetscInt *rows; | |||
91 | PetscErrorCode ierr; | |||
92 | ||||
93 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 93; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
94 | ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),94,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
95 | diag = a->diag; | |||
96 | for (i=0; i<m; i++) { | |||
97 | if ((diag[i] >= ii[i+1]) || (jj[diag[i]] != i) || (aa[diag[i]] == 0.0)) { | |||
98 | cnt++; | |||
99 | } | |||
100 | } | |||
101 | ierr = PetscMalloc1(cnt,&rows)PetscMallocA(1,PETSC_FALSE,101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(cnt)*sizeof(**(&rows)),(&rows));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
102 | cnt = 0; | |||
103 | for (i=0; i<m; i++) { | |||
104 | if ((diag[i] >= ii[i+1]) || (jj[diag[i]] != i) || (aa[diag[i]] == 0.0)) { | |||
105 | rows[cnt++] = i; | |||
106 | } | |||
107 | } | |||
108 | *nrows = cnt; | |||
109 | *zrows = rows; | |||
110 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
111 | } | |||
112 | ||||
113 | PetscErrorCode MatFindZeroDiagonals_SeqAIJ(Mat A,IS *zrows) | |||
114 | { | |||
115 | PetscInt nrows,*rows; | |||
116 | PetscErrorCode ierr; | |||
117 | ||||
118 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 118; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
119 | *zrows = NULL((void*)0); | |||
120 | ierr = MatFindZeroDiagonals_SeqAIJ_Private(A,&nrows,&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
121 | ierr = ISCreateGeneral(PetscObjectComm((PetscObject)A),nrows,rows,PETSC_OWN_POINTER,zrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),121,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
122 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
123 | } | |||
124 | ||||
125 | PetscErrorCode MatFindNonzeroRows_SeqAIJ(Mat A,IS *keptrows) | |||
126 | { | |||
127 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
128 | const MatScalar *aa; | |||
129 | PetscInt m=A->rmap->n,cnt = 0; | |||
130 | const PetscInt *ii; | |||
131 | PetscInt n,i,j,*rows; | |||
132 | PetscErrorCode ierr; | |||
133 | ||||
134 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 134; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
135 | *keptrows = 0; | |||
136 | ii = a->i; | |||
137 | for (i=0; i<m; i++) { | |||
138 | n = ii[i+1] - ii[i]; | |||
139 | if (!n) { | |||
140 | cnt++; | |||
141 | goto ok1; | |||
142 | } | |||
143 | aa = a->a + ii[i]; | |||
144 | for (j=0; j<n; j++) { | |||
145 | if (aa[j] != 0.0) goto ok1; | |||
146 | } | |||
147 | cnt++; | |||
148 | ok1:; | |||
149 | } | |||
150 | if (!cnt) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
151 | ierr = PetscMalloc1(A->rmap->n-cnt,&rows)PetscMallocA(1,PETSC_FALSE,151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(A->rmap->n-cnt)*sizeof(**(&rows)),(&rows ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
152 | cnt = 0; | |||
153 | for (i=0; i<m; i++) { | |||
154 | n = ii[i+1] - ii[i]; | |||
155 | if (!n) continue; | |||
156 | aa = a->a + ii[i]; | |||
157 | for (j=0; j<n; j++) { | |||
158 | if (aa[j] != 0.0) { | |||
159 | rows[cnt++] = i; | |||
160 | break; | |||
161 | } | |||
162 | } | |||
163 | } | |||
164 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cnt,rows,PETSC_OWN_POINTER,keptrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
165 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
166 | } | |||
167 | ||||
168 | PetscErrorCode MatDiagonalSet_SeqAIJ(Mat Y,Vec D,InsertMode is) | |||
169 | { | |||
170 | PetscErrorCode ierr; | |||
171 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*) Y->data; | |||
172 | PetscInt i,m = Y->rmap->n; | |||
173 | const PetscInt *diag; | |||
174 | MatScalar *aa = aij->a; | |||
175 | const PetscScalar *v; | |||
176 | PetscBool missing; | |||
177 | ||||
178 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 178; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
179 | if (Y->assembled) { | |||
180 | ierr = MatMissingDiagonal_SeqAIJ(Y,&missing,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
181 | if (!missing) { | |||
182 | diag = aij->diag; | |||
183 | ierr = VecGetArrayRead(D,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
184 | if (is == INSERT_VALUES) { | |||
185 | for (i=0; i<m; i++) { | |||
186 | aa[diag[i]] = v[i]; | |||
187 | } | |||
188 | } else { | |||
189 | for (i=0; i<m; i++) { | |||
190 | aa[diag[i]] += v[i]; | |||
191 | } | |||
192 | } | |||
193 | ierr = VecRestoreArrayRead(D,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
194 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
195 | } | |||
196 | ierr = MatSeqAIJInvalidateDiagonal(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
197 | } | |||
198 | ierr = MatDiagonalSet_Default(Y,D,is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
199 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
200 | } | |||
201 | ||||
202 | PetscErrorCode MatGetRowIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *m,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
203 | { | |||
204 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
205 | PetscErrorCode ierr; | |||
206 | PetscInt i,ishift; | |||
207 | ||||
208 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 208; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
209 | *m = A->rmap->n; | |||
210 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
211 | ishift = 0; | |||
212 | if (symmetric && !A->structurally_symmetric) { | |||
213 | ierr = MatToSymmetricIJ_SeqAIJ(A->rmap->n,a->i,a->j,PETSC_TRUE,ishift,oshift,(PetscInt**)ia,(PetscInt**)ja);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
214 | } else if (oshift == 1) { | |||
215 | PetscInt *tia; | |||
216 | PetscInt nz = a->i[A->rmap->n]; | |||
217 | /* malloc space and add 1 to i and j indices */ | |||
218 | ierr = PetscMalloc1(A->rmap->n+1,&tia)PetscMallocA(1,PETSC_FALSE,218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(A->rmap->n+1)*sizeof(**(&tia)),(&tia) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
219 | for (i=0; i<A->rmap->n+1; i++) tia[i] = a->i[i] + 1; | |||
220 | *ia = tia; | |||
221 | if (ja) { | |||
222 | PetscInt *tja; | |||
223 | ierr = PetscMalloc1(nz+1,&tja)PetscMallocA(1,PETSC_FALSE,223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nz+1)*sizeof(**(&tja)),(&tja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
224 | for (i=0; i<nz; i++) tja[i] = a->j[i] + 1; | |||
225 | *ja = tja; | |||
226 | } | |||
227 | } else { | |||
228 | *ia = a->i; | |||
229 | if (ja) *ja = a->j; | |||
230 | } | |||
231 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
232 | } | |||
233 | ||||
234 | PetscErrorCode MatRestoreRowIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
235 | { | |||
236 | PetscErrorCode ierr; | |||
237 | ||||
238 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 238; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
239 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
240 | if ((symmetric && !A->structurally_symmetric) || oshift == 1) { | |||
241 | ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((*ia) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
242 | if (ja) {ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((*ja) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
243 | } | |||
244 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
245 | } | |||
246 | ||||
247 | PetscErrorCode MatGetColumnIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
248 | { | |||
249 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
250 | PetscErrorCode ierr; | |||
251 | PetscInt i,*collengths,*cia,*cja,n = A->cmap->n,m = A->rmap->n; | |||
252 | PetscInt nz = a->i[m],row,*jj,mr,col; | |||
253 | ||||
254 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 254; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
255 | *nn = n; | |||
256 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
257 | if (symmetric) { | |||
258 | ierr = MatToSymmetricIJ_SeqAIJ(A->rmap->n,a->i,a->j,PETSC_TRUE,0,oshift,(PetscInt**)ia,(PetscInt**)ja);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
259 | } else { | |||
260 | ierr = PetscCalloc1(n,&collengths)PetscMallocA(1,PETSC_TRUE,260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(n)*sizeof(**(&collengths)),(&collengths));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
261 | ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(n+1)*sizeof(**(&cia)),(&cia));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
262 | ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nz)*sizeof(**(&cja)),(&cja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
263 | jj = a->j; | |||
264 | for (i=0; i<nz; i++) { | |||
265 | collengths[jj[i]]++; | |||
266 | } | |||
267 | cia[0] = oshift; | |||
268 | for (i=0; i<n; i++) { | |||
269 | cia[i+1] = cia[i] + collengths[i]; | |||
270 | } | |||
271 | ierr = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
272 | jj = a->j; | |||
273 | for (row=0; row<m; row++) { | |||
274 | mr = a->i[row+1] - a->i[row]; | |||
275 | for (i=0; i<mr; i++) { | |||
276 | col = *jj++; | |||
277 | ||||
278 | cja[cia[col] + collengths[col]++ - oshift] = row + oshift; | |||
279 | } | |||
280 | } | |||
281 | ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((collengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
282 | *ia = cia; *ja = cja; | |||
283 | } | |||
284 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
285 | } | |||
286 | ||||
287 | PetscErrorCode MatRestoreColumnIJ_SeqAIJ(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscBool *done) | |||
288 | { | |||
289 | PetscErrorCode ierr; | |||
290 | ||||
291 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 291; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
292 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
293 | ||||
294 | ierr = PetscFree(*ia)((*PetscTrFree)((void*)(*ia),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((*ia) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
295 | ierr = PetscFree(*ja)((*PetscTrFree)((void*)(*ja),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((*ja) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
296 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
297 | } | |||
298 | ||||
299 | /* | |||
300 | MatGetColumnIJ_SeqAIJ_Color() and MatRestoreColumnIJ_SeqAIJ_Color() are customized from | |||
301 | MatGetColumnIJ_SeqAIJ() and MatRestoreColumnIJ_SeqAIJ() by adding an output | |||
302 | spidx[], index of a->a, to be used in MatTransposeColoringCreate_SeqAIJ() and MatFDColoringCreate_SeqXAIJ() | |||
303 | */ | |||
304 | PetscErrorCode MatGetColumnIJ_SeqAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *nn,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done) | |||
305 | { | |||
306 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
307 | PetscErrorCode ierr; | |||
308 | PetscInt i,*collengths,*cia,*cja,n = A->cmap->n,m = A->rmap->n; | |||
309 | PetscInt nz = a->i[m],row,mr,col,tmp; | |||
310 | PetscInt *cspidx; | |||
311 | const PetscInt *jj; | |||
312 | ||||
313 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 313; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
314 | *nn = n; | |||
315 | if (!ia) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
316 | ||||
317 | ierr = PetscCalloc1(n,&collengths)PetscMallocA(1,PETSC_TRUE,317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(n)*sizeof(**(&collengths)),(&collengths));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
318 | ierr = PetscMalloc1(n+1,&cia)PetscMallocA(1,PETSC_FALSE,318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(n+1)*sizeof(**(&cia)),(&cia));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
319 | ierr = PetscMalloc1(nz,&cja)PetscMallocA(1,PETSC_FALSE,319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nz)*sizeof(**(&cja)),(&cja));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
320 | ierr = PetscMalloc1(nz,&cspidx)PetscMallocA(1,PETSC_FALSE,320,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nz)*sizeof(**(&cspidx)),(&cspidx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),320,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
321 | jj = a->j; | |||
322 | for (i=0; i<nz; i++) { | |||
323 | collengths[jj[i]]++; | |||
324 | } | |||
325 | cia[0] = oshift; | |||
326 | for (i=0; i<n; i++) { | |||
327 | cia[i+1] = cia[i] + collengths[i]; | |||
328 | } | |||
329 | ierr = PetscArrayzero(collengths,n)PetscMemzero(collengths,(n)*sizeof(*(collengths)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
330 | jj = a->j; | |||
331 | for (row=0; row<m; row++) { | |||
332 | mr = a->i[row+1] - a->i[row]; | |||
333 | for (i=0; i<mr; i++) { | |||
334 | col = *jj++; | |||
335 | tmp = cia[col] + collengths[col]++ - oshift; | |||
336 | cspidx[tmp] = a->i[row] + i; /* index of a->j */ | |||
337 | cja[tmp] = row + oshift; | |||
338 | } | |||
339 | } | |||
340 | ierr = PetscFree(collengths)((*PetscTrFree)((void*)(collengths),340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((collengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
341 | *ia = cia; | |||
342 | *ja = cja; | |||
343 | *spidx = cspidx; | |||
344 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
345 | } | |||
346 | ||||
347 | PetscErrorCode MatRestoreColumnIJ_SeqAIJ_Color(Mat A,PetscInt oshift,PetscBool symmetric,PetscBool inodecompressed,PetscInt *n,const PetscInt *ia[],const PetscInt *ja[],PetscInt *spidx[],PetscBool *done) | |||
348 | { | |||
349 | PetscErrorCode ierr; | |||
350 | ||||
351 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 351; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
352 | ierr = MatRestoreColumnIJ_SeqAIJ(A,oshift,symmetric,inodecompressed,n,ia,ja,done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
353 | ierr = PetscFree(*spidx)((*PetscTrFree)((void*)(*spidx),353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((*spidx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
354 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
355 | } | |||
356 | ||||
357 | PetscErrorCode MatSetValuesRow_SeqAIJ(Mat A,PetscInt row,const PetscScalar v[]) | |||
358 | { | |||
359 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
360 | PetscInt *ai = a->i; | |||
361 | PetscErrorCode ierr; | |||
362 | ||||
363 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 363; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
364 | ierr = PetscArraycpy(a->a+ai[row],v,ai[row+1]-ai[row])((sizeof(*(a->a+ai[row])) != sizeof(*(v))) || PetscMemcpy( a->a+ai[row],v,(ai[row+1]-ai[row])*sizeof(*(a->a+ai[row ]))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
365 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
366 | } | |||
367 | ||||
368 | /* | |||
369 | MatSeqAIJSetValuesLocalFast - An optimized version of MatSetValuesLocal() for SeqAIJ matrices with several assumptions | |||
370 | ||||
371 | - a single row of values is set with each call | |||
372 | - no row or column indices are negative or (in error) larger than the number of rows or columns | |||
373 | - the values are always added to the matrix, not set | |||
374 | - no new locations are introduced in the nonzero structure of the matrix | |||
375 | ||||
376 | This does NOT assume the global column indices are sorted | |||
377 | ||||
378 | */ | |||
379 | ||||
380 | #include <petsc/private/isimpl.h> | |||
381 | PetscErrorCode MatSeqAIJSetValuesLocalFast(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is) | |||
382 | { | |||
383 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
384 | PetscInt low,high,t,row,nrow,i,col,l; | |||
385 | const PetscInt *rp,*ai = a->i,*ailen = a->ilen,*aj = a->j; | |||
386 | PetscInt lastcol = -1; | |||
387 | MatScalar *ap,value,*aa = a->a; | |||
388 | const PetscInt *ridx = A->rmap->mapping->indices,*cidx = A->cmap->mapping->indices; | |||
389 | ||||
390 | row = ridx[im[0]]; | |||
391 | rp = aj + ai[row]; | |||
392 | ap = aa + ai[row]; | |||
393 | nrow = ailen[row]; | |||
394 | low = 0; | |||
395 | high = nrow; | |||
396 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
397 | col = cidx[in[l]]; | |||
398 | value = v[l]; | |||
399 | ||||
400 | if (col <= lastcol) low = 0; | |||
401 | else high = nrow; | |||
402 | lastcol = col; | |||
403 | while (high-low > 5) { | |||
404 | t = (low+high)/2; | |||
405 | if (rp[t] > col) high = t; | |||
406 | else low = t; | |||
407 | } | |||
408 | for (i=low; i<high; i++) { | |||
409 | if (rp[i] == col) { | |||
410 | ap[i] += value; | |||
411 | low = i + 1; | |||
412 | break; | |||
413 | } | |||
414 | } | |||
415 | } | |||
416 | return 0; | |||
417 | } | |||
418 | ||||
419 | PetscErrorCode MatSetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is) | |||
420 | { | |||
421 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
422 | PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N; | |||
423 | PetscInt *imax = a->imax,*ai = a->i,*ailen = a->ilen; | |||
424 | PetscErrorCode ierr; | |||
425 | PetscInt *aj = a->j,nonew = a->nonew,lastcol = -1; | |||
426 | MatScalar *ap=NULL((void*)0),value=0.0,*aa = a->a; | |||
427 | PetscBool ignorezeroentries = a->ignorezeroentries; | |||
428 | PetscBool roworiented = a->roworiented; | |||
429 | ||||
430 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 430; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
431 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
432 | row = im[k]; | |||
433 | if (row < 0) continue; | |||
434 | #if defined(PETSC_USE_DEBUG1) | |||
435 | if (row >= A->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",row,A->rmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),435,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
436 | #endif | |||
437 | rp = aj + ai[row]; | |||
438 | if (!A->structure_only) ap = aa + ai[row]; | |||
439 | rmax = imax[row]; nrow = ailen[row]; | |||
440 | low = 0; | |||
441 | high = nrow; | |||
442 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
443 | if (in[l] < 0) continue; | |||
444 | #if defined(PETSC_USE_DEBUG1) | |||
445 | if (in[l] >= A->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[l],A->cmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),445,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
446 | #endif | |||
447 | col = in[l]; | |||
448 | if (v && !A->structure_only) value = roworiented ? v[l + k*n] : v[k + l*m]; | |||
449 | if (!A->structure_only && value == 0.0 && ignorezeroentries && is == ADD_VALUES && row != col) continue; | |||
450 | ||||
451 | if (col <= lastcol) low = 0; | |||
452 | else high = nrow; | |||
453 | lastcol = col; | |||
454 | while (high-low > 5) { | |||
455 | t = (low+high)/2; | |||
456 | if (rp[t] > col) high = t; | |||
457 | else low = t; | |||
458 | } | |||
459 | for (i=low; i<high; i++) { | |||
460 | if (rp[i] > col) break; | |||
461 | if (rp[i] == col) { | |||
462 | if (!A->structure_only) { | |||
463 | if (is == ADD_VALUES) { | |||
464 | ap[i] += value; | |||
465 | (void)PetscLogFlops(1.0); | |||
466 | } | |||
467 | else ap[i] = value; | |||
468 | } | |||
469 | low = i + 1; | |||
470 | goto noinsert; | |||
471 | } | |||
472 | } | |||
473 | if (value == 0.0 && ignorezeroentries && row != col) goto noinsert; | |||
474 | if (nonew == 1) goto noinsert; | |||
475 | if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at (%D,%D) in the matrix",row,col)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
476 | if (A->structure_only) { | |||
477 | MatSeqXAIJReallocateAIJ_structure_only(A,A->rmap->n,1,nrow,row,col,rmax,ai,aj,rp,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[A->rmap->n] + CHUNKSIZE ,len,*new_i=0,*new_j=0; if (nonew == -2) do {if (__builtin_expect (!!(63),0)) {PetscError(((MPI_Comm)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,477,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", (size_t)(new_nz)*sizeof(**(&new_j)),(&new_j));do {if ( __builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = PetscMallocA(1,PETSC_FALSE,477 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(A->rmap->n+1)*sizeof(**(&new_i)),(&new_i ));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm )0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[ ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof (*(new_j))));do {if (__builtin_expect(!!(ierr),0)) {PetscError (((MPI_Comm)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)) != sizeof (*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE ,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE) )));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm )0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain-> a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!( ierr),0)) {PetscError(((MPI_Comm)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); Ain->a = ((void*)0); ai = Ain-> i = new_i; aj = Ain->j = new_j; Ain->singlemalloc = PETSC_FALSE ; Ain->free_a = PETSC_FALSE; rp = aj + ai[row]; rmax = imax [row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE; Ain ->reallocs++; }; | |||
478 | } else { | |||
479 | MatSeqXAIJReallocateAIJ(A,A->rmap->n,1,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[A->rmap->n] + CHUNKSIZE ,len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,479,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", (size_t)(1*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(A-> rmap->n+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[ ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof (*(new_j))));do {if (__builtin_expect(!!(ierr),0)) {PetscError (((MPI_Comm)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)) != sizeof (*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE ,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE) )));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm )0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = ((sizeof(*(new_a)) != sizeof(* (aa))) || PetscMemcpy(new_a,aa,(1*(ai[row]+nrow))*sizeof(*(new_a ))));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm )0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = PetscMemzero(new_a+1*(ai[row]+ nrow),(1*CHUNKSIZE)*sizeof(*(new_a+1*(ai[row]+nrow))));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = ((sizeof(*(new_a+1*(ai[row]+nrow +CHUNKSIZE))) != sizeof(*(aa+1*(ai[row]+nrow)))) || PetscMemcpy (new_a+1*(ai[row]+nrow+CHUNKSIZE),aa+1*(ai[row]+nrow),(1*len) *sizeof(*(new_a+1*(ai[row]+nrow+CHUNKSIZE)))));do {if (__builtin_expect (!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain-> a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!( ierr),0)) {PetscError(((MPI_Comm)0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); aa = new_a; Ain->a = (MatScalar*) new_a ; ai = Ain->i = new_i; aj = Ain->j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row]; ap = aa + 1*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE ; Ain->reallocs++; }; | |||
480 | } | |||
481 | N = nrow++ - 1; a->nz++; high++; | |||
482 | /* shift up all the later entries in this row */ | |||
483 | ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+ 1,rp+i,(N-i+1)*sizeof(*(rp+i+1))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),483,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
484 | rp[i] = col; | |||
485 | if (!A->structure_only){ | |||
486 | ierr = PetscArraymove(ap+i+1,ap+i,N-i+1)((sizeof(*(ap+i+1)) != sizeof(*(ap+i))) || PetscMemmove(ap+i+ 1,ap+i,(N-i+1)*sizeof(*(ap+i+1))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
487 | ap[i] = value; | |||
488 | } | |||
489 | low = i + 1; | |||
490 | A->nonzerostate++; | |||
491 | noinsert:; | |||
492 | } | |||
493 | ailen[row] = nrow; | |||
494 | } | |||
495 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
496 | } | |||
497 | ||||
498 | PetscErrorCode MatSetValues_SeqAIJ_SortedFull(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode is) | |||
499 | { | |||
500 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
501 | PetscInt *rp,k,row; | |||
502 | PetscInt *ai = a->i,*ailen = a->ilen; | |||
503 | PetscErrorCode ierr; | |||
504 | PetscInt *aj = a->j; | |||
505 | MatScalar *aa = a->a,*ap; | |||
506 | ||||
507 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 507; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
508 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
509 | row = im[k]; | |||
510 | rp = aj + ai[row]; | |||
511 | ap = aa + ai[row]; | |||
512 | if (!A->was_assembled) { | |||
513 | ierr = PetscMemcpy(rp,in,n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),513,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
514 | } | |||
515 | if (!A->structure_only) { | |||
516 | if (v) { | |||
517 | ierr = PetscMemcpy(ap,v,n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),517,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
518 | v += n; | |||
519 | } else { | |||
520 | ierr = PetscMemzero(ap,n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),520,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
521 | } | |||
522 | } | |||
523 | ailen[row] = n; | |||
524 | a->nz += n; | |||
525 | } | |||
526 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
527 | } | |||
528 | ||||
529 | ||||
530 | PetscErrorCode MatGetValues_SeqAIJ(Mat A,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],PetscScalar v[]) | |||
531 | { | |||
532 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
533 | PetscInt *rp,k,low,high,t,row,nrow,i,col,l,*aj = a->j; | |||
534 | PetscInt *ai = a->i,*ailen = a->ilen; | |||
535 | MatScalar *ap,*aa = a->a; | |||
536 | ||||
537 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 537; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
538 | for (k=0; k<m; k++) { /* loop over rows */ | |||
539 | row = im[k]; | |||
540 | if (row < 0) {v += n; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row: %D",row); */ | |||
541 | if (row >= A->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",row,A->rmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
542 | rp = aj + ai[row]; ap = aa + ai[row]; | |||
543 | nrow = ailen[row]; | |||
544 | for (l=0; l<n; l++) { /* loop over columns */ | |||
545 | if (in[l] < 0) {v++; continue;} /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column: %D",in[l]); */ | |||
546 | if (in[l] >= A->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[l],A->cmap->n-1)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
547 | col = in[l]; | |||
548 | high = nrow; low = 0; /* assume unsorted */ | |||
549 | while (high-low > 5) { | |||
550 | t = (low+high)/2; | |||
551 | if (rp[t] > col) high = t; | |||
552 | else low = t; | |||
553 | } | |||
554 | for (i=low; i<high; i++) { | |||
555 | if (rp[i] > col) break; | |||
556 | if (rp[i] == col) { | |||
557 | *v++ = ap[i]; | |||
558 | goto finished; | |||
559 | } | |||
560 | } | |||
561 | *v++ = 0.0; | |||
562 | finished:; | |||
563 | } | |||
564 | } | |||
565 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
566 | } | |||
567 | ||||
568 | ||||
569 | PetscErrorCode MatView_SeqAIJ_Binary(Mat A,PetscViewer viewer) | |||
570 | { | |||
571 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
572 | PetscErrorCode ierr; | |||
573 | PetscInt i,*col_lens; | |||
574 | int fd; | |||
575 | FILE *file; | |||
576 | ||||
577 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 577; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
578 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),578,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
579 | ierr = PetscMalloc1(4+A->rmap->n,&col_lens)PetscMallocA(1,PETSC_FALSE,579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(4+A->rmap->n)*sizeof(**(&col_lens)),(& col_lens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
580 | ||||
581 | col_lens[0] = MAT_FILE_CLASSID1211216; | |||
582 | col_lens[1] = A->rmap->n; | |||
583 | col_lens[2] = A->cmap->n; | |||
584 | col_lens[3] = a->nz; | |||
585 | ||||
586 | /* store lengths of each row and write (including header) to file */ | |||
587 | for (i=0; i<A->rmap->n; i++) { | |||
588 | col_lens[4+i] = a->i[i+1] - a->i[i]; | |||
589 | } | |||
590 | ierr = PetscBinaryWrite(fd,col_lens,4+A->rmap->n,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),590,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
591 | ierr = PetscFree(col_lens)((*PetscTrFree)((void*)(col_lens),591,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((col_lens) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),591,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
592 | ||||
593 | /* store column indices (zero start index) */ | |||
594 | ierr = PetscBinaryWrite(fd,a->j,a->nz,PETSC_INT,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),594,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
595 | ||||
596 | /* store nonzero values */ | |||
597 | ierr = PetscBinaryWrite(fd,a->a,a->nz,PETSC_SCALARPETSC_DOUBLE,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),597,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
598 | ||||
599 | ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),599,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
600 | if (file) { | |||
601 | fprintf(file,"-matload_block_size %d\n",(int)PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A-> rmap->bs)))); | |||
602 | } | |||
603 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
604 | } | |||
605 | ||||
606 | static PetscErrorCode MatView_SeqAIJ_ASCII_structonly(Mat A,PetscViewer viewer) | |||
607 | { | |||
608 | PetscErrorCode ierr; | |||
609 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
610 | PetscInt i,k,m=A->rmap->N; | |||
611 | ||||
612 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 612; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
613 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
614 | for (i=0; i<m; i++) { | |||
615 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),615,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
616 | for (k=a->i[i]; k<a->i[i+1]; k++) { | |||
617 | ierr = PetscViewerASCIIPrintf(viewer," (%D) ",a->j[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
618 | } | |||
619 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),619,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
620 | } | |||
621 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),621,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
622 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
623 | } | |||
624 | ||||
625 | extern PetscErrorCode MatSeqAIJFactorInfo_Matlab(Mat,PetscViewer); | |||
626 | ||||
627 | PetscErrorCode MatView_SeqAIJ_ASCII(Mat A,PetscViewer viewer) | |||
628 | { | |||
629 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
630 | PetscErrorCode ierr; | |||
631 | PetscInt i,j,m = A->rmap->n; | |||
632 | const char *name; | |||
633 | PetscViewerFormat format; | |||
634 | ||||
635 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 635; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
636 | if (A->structure_only) { | |||
637 | ierr = MatView_SeqAIJ_ASCII_structonly(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),637,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
638 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
639 | } | |||
640 | ||||
641 | ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),641,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
642 | if (format == PETSC_VIEWER_ASCII_MATLAB) { | |||
643 | PetscInt nofinalvalue = 0; | |||
644 | if (m && ((a->i[m] == a->i[m-1]) || (a->j[a->nz-1] != A->cmap->n-1))) { | |||
645 | /* Need a dummy value to ensure the dimension of the matrix. */ | |||
646 | nofinalvalue = 1; | |||
647 | } | |||
648 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),648,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
649 | ierr = PetscViewerASCIIPrintf(viewer,"%% Size = %D %D \n",m,A->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),649,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
650 | ierr = PetscViewerASCIIPrintf(viewer,"%% Nonzeros = %D \n",a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
651 | #if defined(PETSC_USE_COMPLEX) | |||
652 | ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,4);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),652,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
653 | #else | |||
654 | ierr = PetscViewerASCIIPrintf(viewer,"zzz = zeros(%D,3);\n",a->nz+nofinalvalue);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),654,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
655 | #endif | |||
656 | ierr = PetscViewerASCIIPrintf(viewer,"zzz = [\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),656,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
657 | ||||
658 | for (i=0; i<m; i++) { | |||
659 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
660 | #if defined(PETSC_USE_COMPLEX) | |||
661 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e %18.16e\n",i+1,a->j[j]+1,(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
662 | #else | |||
663 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",i+1,a->j[j]+1,(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),663,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
664 | #endif | |||
665 | } | |||
666 | } | |||
667 | if (nofinalvalue) { | |||
668 | #if defined(PETSC_USE_COMPLEX) | |||
669 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e %18.16e\n",m,A->cmap->n,0.,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
670 | #else | |||
671 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D %18.16e\n",m,A->cmap->n,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
672 | #endif | |||
673 | } | |||
674 | ierr = PetscObjectGetName((PetscObject)A,&name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
675 | ierr = PetscViewerASCIIPrintf(viewer,"];\n %s = spconvert(zzz);\n",name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
676 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
677 | } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO || format == PETSC_VIEWER_ASCII_INFO) { | |||
678 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
679 | } else if (format == PETSC_VIEWER_ASCII_COMMON) { | |||
680 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),680,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
681 | for (i=0; i<m; i++) { | |||
682 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
683 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
684 | #if defined(PETSC_USE_COMPLEX) | |||
685 | if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) { | |||
686 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
687 | } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0 && PetscRealPart(a->a[j])(a->a[j]) != 0.0) { | |||
688 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)-PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
689 | } else if (PetscRealPart(a->a[j])(a->a[j]) != 0.0) { | |||
690 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
691 | } | |||
692 | #else | |||
693 | if (a->a[j] != 0.0) {ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
694 | #endif | |||
695 | } | |||
696 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
697 | } | |||
698 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
699 | } else if (format == PETSC_VIEWER_ASCII_SYMMODU) { | |||
700 | PetscInt nzd=0,fshift=1,*sptr; | |||
701 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
702 | ierr = PetscMalloc1(m+1,&sptr)PetscMallocA(1,PETSC_FALSE,702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m+1)*sizeof(**(&sptr)),(&sptr));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
703 | for (i=0; i<m; i++) { | |||
704 | sptr[i] = nzd+1; | |||
705 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
706 | if (a->j[j] >= i) { | |||
707 | #if defined(PETSC_USE_COMPLEX) | |||
708 | if (PetscImaginaryPart(a->a[j])((PetscReal)0.) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) nzd++; | |||
709 | #else | |||
710 | if (a->a[j] != 0.0) nzd++; | |||
711 | #endif | |||
712 | } | |||
713 | } | |||
714 | } | |||
715 | sptr[m] = nzd+1; | |||
716 | ierr = PetscViewerASCIIPrintf(viewer," %D %D\n\n",m,nzd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),716,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
717 | for (i=0; i<m+1; i+=6) { | |||
718 | if (i+4<m) { | |||
719 | ierr = PetscViewerASCIIPrintf(viewer," %D %D %D %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2],sptr[i+3],sptr[i+4],sptr[i+5]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
720 | } else if (i+3<m) { | |||
721 | ierr = PetscViewerASCIIPrintf(viewer," %D %D %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2],sptr[i+3],sptr[i+4]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
722 | } else if (i+2<m) { | |||
723 | ierr = PetscViewerASCIIPrintf(viewer," %D %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2],sptr[i+3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),723,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
724 | } else if (i+1<m) { | |||
725 | ierr = PetscViewerASCIIPrintf(viewer," %D %D %D\n",sptr[i],sptr[i+1],sptr[i+2]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),725,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
726 | } else if (i<m) { | |||
727 | ierr = PetscViewerASCIIPrintf(viewer," %D %D\n",sptr[i],sptr[i+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),727,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
728 | } else { | |||
729 | ierr = PetscViewerASCIIPrintf(viewer," %D\n",sptr[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),729,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
730 | } | |||
731 | } | |||
732 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),732,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
733 | ierr = PetscFree(sptr)((*PetscTrFree)((void*)(sptr),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((sptr) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
734 | for (i=0; i<m; i++) { | |||
735 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
736 | if (a->j[j] >= i) {ierr = PetscViewerASCIIPrintf(viewer," %D ",a->j[j]+fshift);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),736,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
737 | } | |||
738 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),738,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
739 | } | |||
740 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
741 | for (i=0; i<m; i++) { | |||
742 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
743 | if (a->j[j] >= i) { | |||
744 | #if defined(PETSC_USE_COMPLEX) | |||
745 | if (PetscImaginaryPart(a->a[j])((PetscReal)0.) != 0.0 || PetscRealPart(a->a[j])(a->a[j]) != 0.0) { | |||
746 | ierr = PetscViewerASCIIPrintf(viewer," %18.16e %18.16e ",(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
747 | } | |||
748 | #else | |||
749 | if (a->a[j] != 0.0) {ierr = PetscViewerASCIIPrintf(viewer," %18.16e ",(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),749,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
750 | #endif | |||
751 | } | |||
752 | } | |||
753 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),753,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
754 | } | |||
755 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
756 | } else if (format == PETSC_VIEWER_ASCII_DENSE) { | |||
757 | PetscInt cnt = 0,jcnt; | |||
758 | PetscScalar value; | |||
759 | #if defined(PETSC_USE_COMPLEX) | |||
760 | PetscBool realonly = PETSC_TRUE; | |||
761 | ||||
762 | for (i=0; i<a->i[m]; i++) { | |||
763 | if (PetscImaginaryPart(a->a[i])((PetscReal)0.) != 0.0) { | |||
764 | realonly = PETSC_FALSE; | |||
765 | break; | |||
766 | } | |||
767 | } | |||
768 | #endif | |||
769 | ||||
770 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),770,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
771 | for (i=0; i<m; i++) { | |||
772 | jcnt = 0; | |||
773 | for (j=0; j<A->cmap->n; j++) { | |||
774 | if (jcnt < a->i[i+1]-a->i[i] && j == a->j[cnt]) { | |||
775 | value = a->a[cnt++]; | |||
776 | jcnt++; | |||
777 | } else { | |||
778 | value = 0.0; | |||
779 | } | |||
780 | #if defined(PETSC_USE_COMPLEX) | |||
781 | if (realonly) { | |||
782 | ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)PetscRealPart(value)(value));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),782,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
783 | } else { | |||
784 | ierr = PetscViewerASCIIPrintf(viewer," %7.5e+%7.5e i ",(double)PetscRealPart(value)(value),(double)PetscImaginaryPart(value)((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),784,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
785 | } | |||
786 | #else | |||
787 | ierr = PetscViewerASCIIPrintf(viewer," %7.5e ",(double)value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),787,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
788 | #endif | |||
789 | } | |||
790 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),790,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
791 | } | |||
792 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
793 | } else if (format == PETSC_VIEWER_ASCII_MATRIXMARKET) { | |||
794 | PetscInt fshift=1; | |||
795 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
796 | #if defined(PETSC_USE_COMPLEX) | |||
797 | ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate complex general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
798 | #else | |||
799 | ierr = PetscViewerASCIIPrintf(viewer,"%%%%MatrixMarket matrix coordinate real general\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),799,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
800 | #endif | |||
801 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D %D\n", m, A->cmap->n, a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),801,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
802 | for (i=0; i<m; i++) { | |||
803 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
804 | #if defined(PETSC_USE_COMPLEX) | |||
805 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D %g %g\n", i+fshift,a->j[j]+fshift,(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
806 | #else | |||
807 | ierr = PetscViewerASCIIPrintf(viewer,"%D %D %g\n", i+fshift, a->j[j]+fshift, (double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
808 | #endif | |||
809 | } | |||
810 | } | |||
811 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
812 | } else { | |||
813 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
814 | if (A->factortype) { | |||
815 | for (i=0; i<m; i++) { | |||
816 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),816,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
817 | /* L part */ | |||
818 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
819 | #if defined(PETSC_USE_COMPLEX) | |||
820 | if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) { | |||
821 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),821,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
822 | } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) { | |||
823 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)(-PetscImaginaryPart(a->a[j])((PetscReal)0.)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),823,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
824 | } else { | |||
825 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),825,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
826 | } | |||
827 | #else | |||
828 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),828,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
829 | #endif | |||
830 | } | |||
831 | /* diagonal */ | |||
832 | j = a->diag[i]; | |||
833 | #if defined(PETSC_USE_COMPLEX) | |||
834 | if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) { | |||
835 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(1.0/a->a[j])(1.0/a->a[j]),(double)PetscImaginaryPart(1.0/a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),835,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
836 | } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) { | |||
837 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(1.0/a->a[j])(1.0/a->a[j]),(double)(-PetscImaginaryPart(1.0/a->a[j])((PetscReal)0.)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),837,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
838 | } else { | |||
839 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(1.0/a->a[j])(1.0/a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
840 | } | |||
841 | #else | |||
842 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)(1.0/a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
843 | #endif | |||
844 | ||||
845 | /* U part */ | |||
846 | for (j=a->diag[i+1]+1; j<a->diag[i]; j++) { | |||
847 | #if defined(PETSC_USE_COMPLEX) | |||
848 | if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) { | |||
849 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),849,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
850 | } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) { | |||
851 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)(-PetscImaginaryPart(a->a[j])((PetscReal)0.)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
852 | } else { | |||
853 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),853,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
854 | } | |||
855 | #else | |||
856 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),856,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
857 | #endif | |||
858 | } | |||
859 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),859,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
860 | } | |||
861 | } else { | |||
862 | for (i=0; i<m; i++) { | |||
863 | ierr = PetscViewerASCIIPrintf(viewer,"row %D:",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),863,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
864 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
865 | #if defined(PETSC_USE_COMPLEX) | |||
866 | if (PetscImaginaryPart(a->a[j])((PetscReal)0.) > 0.0) { | |||
867 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g + %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
868 | } else if (PetscImaginaryPart(a->a[j])((PetscReal)0.) < 0.0) { | |||
869 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g - %g i)",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]),(double)-PetscImaginaryPart(a->a[j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
870 | } else { | |||
871 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)PetscRealPart(a->a[j])(a->a[j]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),871,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
872 | } | |||
873 | #else | |||
874 | ierr = PetscViewerASCIIPrintf(viewer," (%D, %g) ",a->j[j],(double)a->a[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),874,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
875 | #endif | |||
876 | } | |||
877 | ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
878 | } | |||
879 | } | |||
880 | ierr = PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),880,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
881 | } | |||
882 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),882,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
883 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
884 | } | |||
885 | ||||
886 | #include <petscdraw.h> | |||
887 | PetscErrorCode MatView_SeqAIJ_Draw_Zoom(PetscDraw draw,void *Aa) | |||
888 | { | |||
889 | Mat A = (Mat) Aa; | |||
890 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
891 | PetscErrorCode ierr; | |||
892 | PetscInt i,j,m = A->rmap->n; | |||
893 | int color; | |||
894 | PetscReal xl,yl,xr,yr,x_l,x_r,y_l,y_r; | |||
895 | PetscViewer viewer; | |||
896 | PetscViewerFormat format; | |||
897 | ||||
898 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 898; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
899 | ierr = PetscObjectQuery((PetscObject)A,"Zoomviewer",(PetscObject*)&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),899,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
900 | ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),900,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
901 | ierr = PetscDrawGetCoordinates(draw,&xl,&yl,&xr,&yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),901,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
902 | ||||
903 | /* loop over matrix elements drawing boxes */ | |||
904 | ||||
905 | if (format != PETSC_VIEWER_DRAW_CONTOUR) { | |||
906 | ierr = PetscDrawCollectiveBegin(draw)0; do { PetscErrorCode _Petsc_ierr; jmp_buf _Petsc_jmpbuf; volatile PetscXIOErrorHandler _Petsc_xioerrhdl = ((void*)0); PetscBool _Petsc_isdrawx, _Petsc_xioerr, _Petsc_xioerr_local = PETSC_FALSE ; _Petsc_ierr = PetscObjectTypeCompare((PetscObject)(draw),"x" ,&_Petsc_isdrawx);do {if (__builtin_expect(!!(_Petsc_ierr ),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_isdrawx ) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf ,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr ),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_xioerrhdl = PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); if (_setjmp (PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE ; do {_Petsc_ierr = 0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler (_Petsc_xioerrhdl); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm )0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw) ))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr ),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject )(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError (((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", _Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } } } while(0);do {if (__builtin_expect(!!(_Petsc_ierr ),0)) {PetscError(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0);} } do {} while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
907 | /* Blue for negative, Cyan for zero and Red for positive */ | |||
908 | color = PETSC_DRAW_BLUE5; | |||
909 | for (i=0; i<m; i++) { | |||
910 | y_l = m - i - 1.0; y_r = y_l + 1.0; | |||
911 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
912 | x_l = a->j[j]; x_r = x_l + 1.0; | |||
913 | if (PetscRealPart(a->a[j])(a->a[j]) >= 0.) continue; | |||
914 | ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),914,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
915 | } | |||
916 | } | |||
917 | color = PETSC_DRAW_CYAN4; | |||
918 | for (i=0; i<m; i++) { | |||
919 | y_l = m - i - 1.0; y_r = y_l + 1.0; | |||
920 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
921 | x_l = a->j[j]; x_r = x_l + 1.0; | |||
922 | if (a->a[j] != 0.) continue; | |||
923 | ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
924 | } | |||
925 | } | |||
926 | color = PETSC_DRAW_RED2; | |||
927 | for (i=0; i<m; i++) { | |||
928 | y_l = m - i - 1.0; y_r = y_l + 1.0; | |||
929 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
930 | x_l = a->j[j]; x_r = x_l + 1.0; | |||
931 | if (PetscRealPart(a->a[j])(a->a[j]) <= 0.) continue; | |||
932 | ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),932,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
933 | } | |||
934 | } | |||
935 | ierr = PetscDrawCollectiveEnd(draw)0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler(_Petsc_xioerrhdl ); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm )0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw) ))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr ),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject )(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError (((MPI_Comm)0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),935,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", _Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } } } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
936 | } else { | |||
937 | /* use contour shading to indicate magnitude of values */ | |||
938 | /* first determine max of all nonzero values */ | |||
939 | PetscReal minv = 0.0, maxv = 0.0; | |||
940 | PetscInt nz = a->nz, count = 0; | |||
941 | PetscDraw popup; | |||
942 | ||||
943 | for (i=0; i<nz; i++) { | |||
944 | if (PetscAbsScalar(a->a[i]) > maxv) maxv = PetscAbsScalar(a->a[i]); | |||
945 | } | |||
946 | if (minv >= maxv) maxv = minv + PETSC_SMALL1.e-10; | |||
947 | ierr = PetscDrawGetPopup(draw,&popup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),947,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
948 | ierr = PetscDrawScalePopup(popup,minv,maxv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),948,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
949 | ||||
950 | ierr = PetscDrawCollectiveBegin(draw)0; do { PetscErrorCode _Petsc_ierr; jmp_buf _Petsc_jmpbuf; volatile PetscXIOErrorHandler _Petsc_xioerrhdl = ((void*)0); PetscBool _Petsc_isdrawx, _Petsc_xioerr, _Petsc_xioerr_local = PETSC_FALSE ; _Petsc_ierr = PetscObjectTypeCompare((PetscObject)(draw),"x" ,&_Petsc_isdrawx);do {if (__builtin_expect(!!(_Petsc_ierr ),0)) {PetscError(((MPI_Comm)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_isdrawx ) { _Petsc_ierr = PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf ,sizeof(_Petsc_jmpbuf));do {if (__builtin_expect(!!(_Petsc_ierr ),0)) {PetscError(((MPI_Comm)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_xioerrhdl = PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); if (_setjmp (PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE ; do {_Petsc_ierr = 0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler (_Petsc_xioerrhdl); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm )0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw) ))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr ),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject )(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError (((MPI_Comm)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),950,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", _Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } } } while(0);do {if (__builtin_expect(!!(_Petsc_ierr ),0)) {PetscError(((MPI_Comm)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0);} } do {} while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
951 | for (i=0; i<m; i++) { | |||
952 | y_l = m - i - 1.0; | |||
953 | y_r = y_l + 1.0; | |||
954 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
955 | x_l = a->j[j]; | |||
956 | x_r = x_l + 1.0; | |||
957 | color = PetscDrawRealToColor(PetscAbsScalar(a->a[count]),minv,maxv); | |||
958 | ierr = PetscDrawRectangle(draw,x_l,y_l,x_r,y_r,color,color,color,color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),958,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
959 | count++; | |||
960 | } | |||
961 | } | |||
962 | ierr = PetscDrawCollectiveEnd(draw)0; if (_Petsc_isdrawx) { (void)PetscSetXIOErrorHandler(_Petsc_xioerrhdl ); _Petsc_ierr = PetscMemcpy(&PetscXIOErrorHandlerJumpBuf ,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));do { if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm )0x44000001),962,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); _Petsc_ierr = ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm((PetscObject)(draw) ))),0) || MPI_Allreduce((&_Petsc_xioerr_local),(&_Petsc_xioerr ),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject )(draw)))));do {if (__builtin_expect(!!(_Petsc_ierr),0)) {PetscError (((MPI_Comm)0x44000001),962,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); if (_Petsc_xioerr ) { _Petsc_ierr = PetscDrawSetType((draw),"null");do {if (__builtin_expect (!!(_Petsc_ierr),0)) {PetscError(((MPI_Comm)0x44000001),962,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", _Petsc_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm ((PetscObject)A),_Petsc_ierr);}} while (0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } } } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),962,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
963 | } | |||
964 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
965 | } | |||
966 | ||||
967 | #include <petscdraw.h> | |||
968 | PetscErrorCode MatView_SeqAIJ_Draw(Mat A,PetscViewer viewer) | |||
969 | { | |||
970 | PetscErrorCode ierr; | |||
971 | PetscDraw draw; | |||
972 | PetscReal xr,yr,xl,yl,h,w; | |||
973 | PetscBool isnull; | |||
974 | ||||
975 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 975; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
976 | ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
977 | ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),977,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
978 | if (isnull) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
979 | ||||
980 | xr = A->cmap->n; yr = A->rmap->n; h = yr/10.0; w = xr/10.0; | |||
981 | xr += w; yr += h; xl = -w; yl = -h; | |||
982 | ierr = PetscDrawSetCoordinates(draw,xl,yl,xr,yr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),982,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
983 | ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",(PetscObject)viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),983,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
984 | ierr = PetscDrawZoom(draw,MatView_SeqAIJ_Draw_Zoom,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),984,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
985 | ierr = PetscObjectCompose((PetscObject)A,"Zoomviewer",NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),985,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
986 | ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
987 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
988 | } | |||
989 | ||||
990 | PetscErrorCode MatView_SeqAIJ(Mat A,PetscViewer viewer) | |||
991 | { | |||
992 | PetscErrorCode ierr; | |||
993 | PetscBool iascii,isbinary,isdraw; | |||
994 | ||||
995 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 995; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
996 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
997 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
998 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),998,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
999 | if (iascii) { | |||
1000 | ierr = MatView_SeqAIJ_ASCII(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1000,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1001 | } else if (isbinary) { | |||
1002 | ierr = MatView_SeqAIJ_Binary(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1002,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1003 | } else if (isdraw) { | |||
1004 | ierr = MatView_SeqAIJ_Draw(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1004,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1005 | } | |||
1006 | ierr = MatView_SeqAIJ_Inode(A,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1006,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1007 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1008 | } | |||
1009 | ||||
1010 | PetscErrorCode MatAssemblyEnd_SeqAIJ(Mat A,MatAssemblyType mode) | |||
1011 | { | |||
1012 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1013 | PetscErrorCode ierr; | |||
1014 | PetscInt fshift = 0,i,*ai = a->i,*aj = a->j,*imax = a->imax; | |||
1015 | PetscInt m = A->rmap->n,*ip,N,*ailen = a->ilen,rmax = 0; | |||
1016 | MatScalar *aa = a->a,*ap; | |||
1017 | PetscReal ratio = 0.6; | |||
1018 | ||||
1019 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1019; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1020 | if (mode == MAT_FLUSH_ASSEMBLY) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1021 | ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1021,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1022 | if (A->was_assembled && A->ass_nonzerostate == A->nonzerostate) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1023 | ||||
1024 | if (m) rmax = ailen[0]; /* determine row with most nonzeros */ | |||
1025 | for (i=1; i<m; i++) { | |||
1026 | /* move each row back by the amount of empty slots (fshift) before it*/ | |||
1027 | fshift += imax[i-1] - ailen[i-1]; | |||
1028 | rmax = PetscMax(rmax,ailen[i])(((rmax)<(ailen[i])) ? (ailen[i]) : (rmax)); | |||
1029 | if (fshift) { | |||
1030 | ip = aj + ai[i]; | |||
1031 | ap = aa + ai[i]; | |||
1032 | N = ailen[i]; | |||
1033 | ierr = PetscArraymove(ip-fshift,ip,N)((sizeof(*(ip-fshift)) != sizeof(*(ip))) || PetscMemmove(ip-fshift ,ip,(N)*sizeof(*(ip-fshift))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1033,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1034 | if (!A->structure_only) { | |||
1035 | ierr = PetscArraymove(ap-fshift,ap,N)((sizeof(*(ap-fshift)) != sizeof(*(ap))) || PetscMemmove(ap-fshift ,ap,(N)*sizeof(*(ap-fshift))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1035,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1036 | } | |||
1037 | } | |||
1038 | ai[i] = ai[i-1] + ailen[i-1]; | |||
1039 | } | |||
1040 | if (m) { | |||
1041 | fshift += imax[m-1] - ailen[m-1]; | |||
1042 | ai[m] = ai[m-1] + ailen[m-1]; | |||
1043 | } | |||
1044 | ||||
1045 | /* reset ilen and imax for each row */ | |||
1046 | a->nonzerorowcnt = 0; | |||
1047 | if (A->structure_only) { | |||
1048 | ierr = PetscFree(a->imax)((*PetscTrFree)((void*)(a->imax),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->imax) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1049 | ierr = PetscFree(a->ilen)((*PetscTrFree)((void*)(a->ilen),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->ilen) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1050 | } else { /* !A->structure_only */ | |||
1051 | for (i=0; i<m; i++) { | |||
1052 | ailen[i] = imax[i] = ai[i+1] - ai[i]; | |||
1053 | a->nonzerorowcnt += ((ai[i+1] - ai[i]) > 0); | |||
1054 | } | |||
1055 | } | |||
1056 | a->nz = ai[m]; | |||
1057 | if (fshift && a->nounused == -1) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_PLIB, "Unused space detected in matrix: %D X %D, %D unneeded", m, A->cmap->n, fshift)do {if (__builtin_expect(!!(77),0)) {PetscError(((MPI_Comm)0x44000001 ),1057,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 77);}} while (0); | |||
1058 | ||||
1059 | ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1059,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1060 | ierr = PetscInfo4(A,"Matrix size: %D X %D; storage space: %D unneeded,%D used\n",m,A->cmap->n,fshift,a->nz)PetscInfo_Private(__func__,A,"Matrix size: %D X %D; storage space: %D unneeded,%D used\n" ,m,A->cmap->n,fshift,a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1060,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1061 | ierr = PetscInfo1(A,"Number of mallocs during MatSetValues() is %D\n",a->reallocs)PetscInfo_Private(__func__,A,"Number of mallocs during MatSetValues() is %D\n" ,a->reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1061,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1062 | ierr = PetscInfo1(A,"Maximum nonzeros in any row is %D\n",rmax)PetscInfo_Private(__func__,A,"Maximum nonzeros in any row is %D\n" ,rmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1063 | ||||
1064 | A->info.mallocs += a->reallocs; | |||
1065 | a->reallocs = 0; | |||
1066 | A->info.nz_unneeded = (PetscReal)fshift; | |||
1067 | a->rmax = rmax; | |||
1068 | ||||
1069 | if (!A->structure_only) { | |||
1070 | ierr = MatCheckCompressedRow(A,a->nonzerorowcnt,&a->compressedrow,a->i,m,ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1070,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1071 | } | |||
1072 | ierr = MatAssemblyEnd_SeqAIJ_Inode(A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1073 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1074 | } | |||
1075 | ||||
1076 | PetscErrorCode MatRealPart_SeqAIJ(Mat A) | |||
1077 | { | |||
1078 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1079 | PetscInt i,nz = a->nz; | |||
1080 | MatScalar *aa = a->a; | |||
1081 | PetscErrorCode ierr; | |||
1082 | ||||
1083 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1083; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1084 | for (i=0; i<nz; i++) aa[i] = PetscRealPart(aa[i])(aa[i]); | |||
1085 | ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1086 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1087 | } | |||
1088 | ||||
1089 | PetscErrorCode MatImaginaryPart_SeqAIJ(Mat A) | |||
1090 | { | |||
1091 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1092 | PetscInt i,nz = a->nz; | |||
1093 | MatScalar *aa = a->a; | |||
1094 | PetscErrorCode ierr; | |||
1095 | ||||
1096 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1096; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1097 | for (i=0; i<nz; i++) aa[i] = PetscImaginaryPart(aa[i])((PetscReal)0.); | |||
1098 | ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1099 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1100 | } | |||
1101 | ||||
1102 | PetscErrorCode MatZeroEntries_SeqAIJ(Mat A) | |||
1103 | { | |||
1104 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1105 | PetscErrorCode ierr; | |||
1106 | ||||
1107 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1107; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1108 | ierr = PetscArrayzero(a->a,a->i[A->rmap->n])PetscMemzero(a->a,(a->i[A->rmap->n])*sizeof(*(a-> a)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1109 | ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1110 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1111 | } | |||
1112 | ||||
1113 | PetscErrorCode MatDestroy_SeqAIJ(Mat A) | |||
1114 | { | |||
1115 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1116 | PetscErrorCode ierr; | |||
1117 | ||||
1118 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1118; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1119 | #if defined(PETSC_USE_LOG1) | |||
1120 | PetscLogObjectState((PetscObject)A,"Rows=%D, Cols=%D, NZ=%D",A->rmap->n,A->cmap->n,a->nz); | |||
1121 | #endif | |||
1122 | ierr = MatSeqXAIJFreeAIJ(A,&a->a,&a->j,&a->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1123 | ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1124 | ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1125 | ierr = PetscFree(a->diag)((*PetscTrFree)((void*)(a->diag),1125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->diag) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1126 | ierr = PetscFree(a->ibdiag)((*PetscTrFree)((void*)(a->ibdiag),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->ibdiag) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1127 | ierr = PetscFree(a->imax)((*PetscTrFree)((void*)(a->imax),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->imax) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1128 | ierr = PetscFree(a->ilen)((*PetscTrFree)((void*)(a->ilen),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->ilen) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1129 | ierr = PetscFree(a->ipre)((*PetscTrFree)((void*)(a->ipre),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->ipre) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1130 | ierr = PetscFree3(a->idiag,a->mdiag,a->ssor_work)PetscFreeA(3,1130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(a->idiag),&(a->mdiag),&(a->ssor_work) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1131 | ierr = PetscFree(a->solve_work)((*PetscTrFree)((void*)(a->solve_work),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->solve_work) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1132 | ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1132,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1133 | ierr = PetscFree(a->saved_values)((*PetscTrFree)((void*)(a->saved_values),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((a->saved_values) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1134 | ierr = ISColoringDestroy(&a->coloring);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1134,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1135 | ierr = PetscFree2(a->compressedrow.i,a->compressedrow.rindex)PetscFreeA(2,1135,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(a->compressedrow.i),&(a->compressedrow.rindex ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1135,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1136 | ierr = PetscFree(a->matmult_abdense)((*PetscTrFree)((void*)(a->matmult_abdense),1136,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c") || ((a->matmult_abdense) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1136,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1137 | ||||
1138 | ierr = MatDestroy_SeqAIJ_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1139 | ierr = PetscFree(A->data)((*PetscTrFree)((void*)(A->data),1139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((A->data) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1140 | ||||
1141 | ierr = PetscObjectChangeTypeName((PetscObject)A,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1141,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1142 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqAIJSetColumnIndices_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqAIJSetColumnIndices_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1143 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatStoreValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatStoreValues_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1143,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1144 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatRetrieveValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatRetrieveValues_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1145 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqsbaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqsbaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1145,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1146 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqbaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqbaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1147 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqaijperm_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqaijperm_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1147,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1148 | #if defined(PETSC_HAVE_ELEMENTAL) | |||
1149 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_elemental_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_elemental_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1149,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1150 | #endif | |||
1151 | #if defined(PETSC_HAVE_HYPRE) | |||
1152 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_hypre_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_hypre_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1153 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatMatMatMult_transpose_seqaij_seqaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatMatMatMult_transpose_seqaij_seqaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1154 | #endif | |||
1155 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqdense_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqdense_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1156 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_seqsell_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_seqsell_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1156,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1157 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatConvert_seqaij_is_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatConvert_seqaij_is_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1158 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatIsTranspose_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatIsTranspose_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1158,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1159 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqAIJSetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqAIJSetPreallocation_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1160 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatResetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatResetPreallocation_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1161 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatSeqAIJSetPreallocationCSR_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatSeqAIJSetPreallocationCSR_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1162 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatReorderForNonzeroDiagonal_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatReorderForNonzeroDiagonal_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1163 | ierr = PetscObjectComposeFunction((PetscObject)A,"MatPtAP_is_seqaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)A,"MatPtAP_is_seqaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1164 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1165 | } | |||
1166 | ||||
1167 | PetscErrorCode MatSetOption_SeqAIJ(Mat A,MatOption op,PetscBool flg) | |||
1168 | { | |||
1169 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1170 | PetscErrorCode ierr; | |||
1171 | ||||
1172 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1172; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1173 | switch (op) { | |||
1174 | case MAT_ROW_ORIENTED: | |||
1175 | a->roworiented = flg; | |||
1176 | break; | |||
1177 | case MAT_KEEP_NONZERO_PATTERN: | |||
1178 | a->keepnonzeropattern = flg; | |||
1179 | break; | |||
1180 | case MAT_NEW_NONZERO_LOCATIONS: | |||
1181 | a->nonew = (flg ? 0 : 1); | |||
1182 | break; | |||
1183 | case MAT_NEW_NONZERO_LOCATION_ERR: | |||
1184 | a->nonew = (flg ? -1 : 0); | |||
1185 | break; | |||
1186 | case MAT_NEW_NONZERO_ALLOCATION_ERR: | |||
1187 | a->nonew = (flg ? -2 : 0); | |||
1188 | break; | |||
1189 | case MAT_UNUSED_NONZERO_LOCATION_ERR: | |||
1190 | a->nounused = (flg ? -1 : 0); | |||
1191 | break; | |||
1192 | case MAT_IGNORE_ZERO_ENTRIES: | |||
1193 | a->ignorezeroentries = flg; | |||
1194 | break; | |||
1195 | case MAT_SPD: | |||
1196 | case MAT_SYMMETRIC: | |||
1197 | case MAT_STRUCTURALLY_SYMMETRIC: | |||
1198 | case MAT_HERMITIAN: | |||
1199 | case MAT_SYMMETRY_ETERNAL: | |||
1200 | case MAT_STRUCTURE_ONLY: | |||
1201 | /* These options are handled directly by MatSetOption() */ | |||
1202 | break; | |||
1203 | case MAT_NEW_DIAGONALS: | |||
1204 | case MAT_IGNORE_OFF_PROC_ENTRIES: | |||
1205 | case MAT_USE_HASH_TABLE: | |||
1206 | ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions [op]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1207 | break; | |||
1208 | case MAT_USE_INODES: | |||
1209 | /* Not an error because MatSetOption_SeqAIJ_Inode handles this one */ | |||
1210 | break; | |||
1211 | case MAT_SUBMAT_SINGLEIS: | |||
1212 | A->submat_singleis = flg; | |||
1213 | break; | |||
1214 | case MAT_SORTED_FULL: | |||
1215 | if (flg) A->ops->setvalues = MatSetValues_SeqAIJ_SortedFull; | |||
1216 | else A->ops->setvalues = MatSetValues_SeqAIJ; | |||
1217 | break; | |||
1218 | default: | |||
1219 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"unknown option %d",op); | |||
1220 | } | |||
1221 | ierr = MatSetOption_SeqAIJ_Inode(A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1222 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1223 | } | |||
1224 | ||||
1225 | PetscErrorCode MatGetDiagonal_SeqAIJ(Mat A,Vec v) | |||
1226 | { | |||
1227 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1228 | PetscErrorCode ierr; | |||
1229 | PetscInt i,j,n,*ai=a->i,*aj=a->j; | |||
1230 | PetscScalar *aa=a->a,*x; | |||
1231 | ||||
1232 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1232; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1233 | ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1234 | if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),1234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector"); | |||
1235 | ||||
1236 | if (A->factortype == MAT_FACTOR_ILU || A->factortype == MAT_FACTOR_LU) { | |||
1237 | PetscInt *diag=a->diag; | |||
1238 | ierr = VecGetArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1239 | for (i=0; i<n; i++) x[i] = 1.0/aa[diag[i]]; | |||
1240 | ierr = VecRestoreArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1241 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1242 | } | |||
1243 | ||||
1244 | ierr = VecGetArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1245 | for (i=0; i<n; i++) { | |||
1246 | x[i] = 0.0; | |||
1247 | for (j=ai[i]; j<ai[i+1]; j++) { | |||
1248 | if (aj[j] == i) { | |||
1249 | x[i] = aa[j]; | |||
1250 | break; | |||
1251 | } | |||
1252 | } | |||
1253 | } | |||
1254 | ierr = VecRestoreArrayWrite(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1254,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1255 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1256 | } | |||
1257 | ||||
1258 | #include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h> | |||
1259 | PetscErrorCode MatMultTransposeAdd_SeqAIJ(Mat A,Vec xx,Vec zz,Vec yy) | |||
1260 | { | |||
1261 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1262 | PetscScalar *y; | |||
1263 | const PetscScalar *x; | |||
1264 | PetscErrorCode ierr; | |||
1265 | PetscInt m = A->rmap->n; | |||
1266 | #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ) | |||
1267 | const MatScalar *v; | |||
1268 | PetscScalar alpha; | |||
1269 | PetscInt n,i,j; | |||
1270 | const PetscInt *idx,*ii,*ridx=NULL((void*)0); | |||
1271 | Mat_CompressedRow cprow = a->compressedrow; | |||
1272 | PetscBool usecprow = cprow.use; | |||
1273 | #endif | |||
1274 | ||||
1275 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1275; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1276 | if (zz != yy) {ierr = VecCopy(zz,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
1277 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1278 | ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1279 | ||||
1280 | #if defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ) | |||
1281 | fortranmulttransposeaddaij_(&m,x,a->i,a->j,a->a,y); | |||
1282 | #else | |||
1283 | if (usecprow) { | |||
1284 | m = cprow.nrows; | |||
1285 | ii = cprow.i; | |||
1286 | ridx = cprow.rindex; | |||
1287 | } else { | |||
1288 | ii = a->i; | |||
1289 | } | |||
1290 | for (i=0; i<m; i++) { | |||
1291 | idx = a->j + ii[i]; | |||
1292 | v = a->a + ii[i]; | |||
1293 | n = ii[i+1] - ii[i]; | |||
1294 | if (usecprow) { | |||
1295 | alpha = x[ridx[i]]; | |||
1296 | } else { | |||
1297 | alpha = x[i]; | |||
1298 | } | |||
1299 | for (j=0; j<n; j++) y[idx[j]] += alpha*v[j]; | |||
1300 | } | |||
1301 | #endif | |||
1302 | ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1302,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1303 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1304 | ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1305 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1306 | } | |||
1307 | ||||
1308 | PetscErrorCode MatMultTranspose_SeqAIJ(Mat A,Vec xx,Vec yy) | |||
1309 | { | |||
1310 | PetscErrorCode ierr; | |||
1311 | ||||
1312 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1312; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1313 | ierr = VecSet(yy,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1313,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1314 | ierr = MatMultTransposeAdd_SeqAIJ(A,xx,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1314,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1315 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1316 | } | |||
1317 | ||||
1318 | #include <../src/mat/impls/aij/seq/ftn-kernels/fmult.h> | |||
1319 | ||||
1320 | PetscErrorCode MatMult_SeqAIJ(Mat A,Vec xx,Vec yy) | |||
1321 | { | |||
1322 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1323 | PetscScalar *y; | |||
1324 | const PetscScalar *x; | |||
1325 | const MatScalar *aa; | |||
1326 | PetscErrorCode ierr; | |||
1327 | PetscInt m=A->rmap->n; | |||
1328 | const PetscInt *aj,*ii,*ridx=NULL((void*)0); | |||
1329 | PetscInt n,i; | |||
1330 | PetscScalar sum; | |||
1331 | PetscBool usecprow=a->compressedrow.use; | |||
1332 | ||||
1333 | #if defined(PETSC_HAVE_PRAGMA_DISJOINT) | |||
1334 | #pragma disjoint(*x,*y,*aa) | |||
1335 | #endif | |||
1336 | ||||
1337 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1337; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1338 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1339 | ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1339,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1340 | ii = a->i; | |||
1341 | if (usecprow) { /* use compressed row format */ | |||
1342 | ierr = PetscArrayzero(y,m)PetscMemzero(y,(m)*sizeof(*(y)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1342,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1343 | m = a->compressedrow.nrows; | |||
1344 | ii = a->compressedrow.i; | |||
1345 | ridx = a->compressedrow.rindex; | |||
1346 | for (i=0; i<m; i++) { | |||
1347 | n = ii[i+1] - ii[i]; | |||
1348 | aj = a->j + ii[i]; | |||
1349 | aa = a->a + ii[i]; | |||
1350 | sum = 0.0; | |||
1351 | PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] * x[aj[__i]];}; | |||
1352 | /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */ | |||
1353 | y[*ridx++] = sum; | |||
1354 | } | |||
1355 | } else { /* do not use compressed row format */ | |||
1356 | #if defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ) | |||
1357 | aj = a->j; | |||
1358 | aa = a->a; | |||
1359 | fortranmultaij_(&m,x,ii,aj,aa,y); | |||
1360 | #else | |||
1361 | for (i=0; i<m; i++) { | |||
1362 | n = ii[i+1] - ii[i]; | |||
1363 | aj = a->j + ii[i]; | |||
1364 | aa = a->a + ii[i]; | |||
1365 | sum = 0.0; | |||
1366 | PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] * x[aj[__i]];}; | |||
1367 | y[i] = sum; | |||
1368 | } | |||
1369 | #endif | |||
1370 | } | |||
1371 | ierr = PetscLogFlops(2.0*a->nz - a->nonzerorowcnt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1371,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1372 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1372,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1373 | ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1373,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1374 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1375 | } | |||
1376 | ||||
1377 | PetscErrorCode MatMultMax_SeqAIJ(Mat A,Vec xx,Vec yy) | |||
1378 | { | |||
1379 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1380 | PetscScalar *y; | |||
1381 | const PetscScalar *x; | |||
1382 | const MatScalar *aa; | |||
1383 | PetscErrorCode ierr; | |||
1384 | PetscInt m=A->rmap->n; | |||
1385 | const PetscInt *aj,*ii,*ridx=NULL((void*)0); | |||
1386 | PetscInt n,i,nonzerorow=0; | |||
1387 | PetscScalar sum; | |||
1388 | PetscBool usecprow=a->compressedrow.use; | |||
1389 | ||||
1390 | #if defined(PETSC_HAVE_PRAGMA_DISJOINT) | |||
1391 | #pragma disjoint(*x,*y,*aa) | |||
1392 | #endif | |||
1393 | ||||
1394 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1394; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1395 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1395,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1396 | ierr = VecGetArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1396,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1397 | if (usecprow) { /* use compressed row format */ | |||
1398 | m = a->compressedrow.nrows; | |||
1399 | ii = a->compressedrow.i; | |||
1400 | ridx = a->compressedrow.rindex; | |||
1401 | for (i=0; i<m; i++) { | |||
1402 | n = ii[i+1] - ii[i]; | |||
1403 | aj = a->j + ii[i]; | |||
1404 | aa = a->a + ii[i]; | |||
1405 | sum = 0.0; | |||
1406 | nonzerorow += (n>0); | |||
1407 | PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))< ((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum) ));}; | |||
1408 | /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */ | |||
1409 | y[*ridx++] = sum; | |||
1410 | } | |||
1411 | } else { /* do not use compressed row format */ | |||
1412 | ii = a->i; | |||
1413 | for (i=0; i<m; i++) { | |||
1414 | n = ii[i+1] - ii[i]; | |||
1415 | aj = a->j + ii[i]; | |||
1416 | aa = a->a + ii[i]; | |||
1417 | sum = 0.0; | |||
1418 | nonzerorow += (n>0); | |||
1419 | PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))< ((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum) ));}; | |||
1420 | y[i] = sum; | |||
1421 | } | |||
1422 | } | |||
1423 | ierr = PetscLogFlops(2.0*a->nz - nonzerorow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1423,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1424 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1424,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1425 | ierr = VecRestoreArray(yy,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1425,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1426 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1427 | } | |||
1428 | ||||
1429 | PetscErrorCode MatMultAddMax_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz) | |||
1430 | { | |||
1431 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1432 | PetscScalar *y,*z; | |||
1433 | const PetscScalar *x; | |||
1434 | const MatScalar *aa; | |||
1435 | PetscErrorCode ierr; | |||
1436 | PetscInt m = A->rmap->n,*aj,*ii; | |||
1437 | PetscInt n,i,*ridx=NULL((void*)0); | |||
1438 | PetscScalar sum; | |||
1439 | PetscBool usecprow=a->compressedrow.use; | |||
1440 | ||||
1441 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1441; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1442 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1443 | ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1443,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1444 | if (usecprow) { /* use compressed row format */ | |||
1445 | if (zz != yy) { | |||
1446 | ierr = PetscArraycpy(z,y,m)((sizeof(*(z)) != sizeof(*(y))) || PetscMemcpy(z,y,(m)*sizeof (*(z))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1446,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1447 | } | |||
1448 | m = a->compressedrow.nrows; | |||
1449 | ii = a->compressedrow.i; | |||
1450 | ridx = a->compressedrow.rindex; | |||
1451 | for (i=0; i<m; i++) { | |||
1452 | n = ii[i+1] - ii[i]; | |||
1453 | aj = a->j + ii[i]; | |||
1454 | aa = a->a + ii[i]; | |||
1455 | sum = y[*ridx]; | |||
1456 | PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))< ((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum) ));}; | |||
1457 | z[*ridx++] = sum; | |||
1458 | } | |||
1459 | } else { /* do not use compressed row format */ | |||
1460 | ii = a->i; | |||
1461 | for (i=0; i<m; i++) { | |||
1462 | n = ii[i+1] - ii[i]; | |||
1463 | aj = a->j + ii[i]; | |||
1464 | aa = a->a + ii[i]; | |||
1465 | sum = y[i]; | |||
1466 | PetscSparseDenseMaxDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum = ((((sum))< ((aa[__i] * x[aj[__i]]))) ? ((aa[__i] * x[aj[__i]])) : ((sum) ));}; | |||
1467 | z[i] = sum; | |||
1468 | } | |||
1469 | } | |||
1470 | ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1471 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1472 | ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1472,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1473 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1474 | } | |||
1475 | ||||
1476 | #include <../src/mat/impls/aij/seq/ftn-kernels/fmultadd.h> | |||
1477 | PetscErrorCode MatMultAdd_SeqAIJ(Mat A,Vec xx,Vec yy,Vec zz) | |||
1478 | { | |||
1479 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1480 | PetscScalar *y,*z; | |||
1481 | const PetscScalar *x; | |||
1482 | const MatScalar *aa; | |||
1483 | PetscErrorCode ierr; | |||
1484 | const PetscInt *aj,*ii,*ridx=NULL((void*)0); | |||
1485 | PetscInt m = A->rmap->n,n,i; | |||
1486 | PetscScalar sum; | |||
1487 | PetscBool usecprow=a->compressedrow.use; | |||
1488 | ||||
1489 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1489; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1490 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1491 | ierr = VecGetArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1492 | if (usecprow) { /* use compressed row format */ | |||
1493 | if (zz != yy) { | |||
1494 | ierr = PetscArraycpy(z,y,m)((sizeof(*(z)) != sizeof(*(y))) || PetscMemcpy(z,y,(m)*sizeof (*(z))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1494,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1495 | } | |||
1496 | m = a->compressedrow.nrows; | |||
1497 | ii = a->compressedrow.i; | |||
1498 | ridx = a->compressedrow.rindex; | |||
1499 | for (i=0; i<m; i++) { | |||
1500 | n = ii[i+1] - ii[i]; | |||
1501 | aj = a->j + ii[i]; | |||
1502 | aa = a->a + ii[i]; | |||
1503 | sum = y[*ridx]; | |||
1504 | PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] * x[aj[__i]];}; | |||
1505 | z[*ridx++] = sum; | |||
1506 | } | |||
1507 | } else { /* do not use compressed row format */ | |||
1508 | ii = a->i; | |||
1509 | #if defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ) | |||
1510 | aj = a->j; | |||
1511 | aa = a->a; | |||
1512 | fortranmultaddaij_(&m,x,ii,aj,aa,y,z); | |||
1513 | #else | |||
1514 | for (i=0; i<m; i++) { | |||
1515 | n = ii[i+1] - ii[i]; | |||
1516 | aj = a->j + ii[i]; | |||
1517 | aa = a->a + ii[i]; | |||
1518 | sum = y[i]; | |||
1519 | PetscSparseDensePlusDot(sum,x,aa,aj,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += aa[__i] * x[aj[__i]];}; | |||
1520 | z[i] = sum; | |||
1521 | } | |||
1522 | #endif | |||
1523 | } | |||
1524 | ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1524,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1525 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1525,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1526 | ierr = VecRestoreArrayPair(yy,zz,&y,&z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1527 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1528 | } | |||
1529 | ||||
1530 | /* | |||
1531 | Adds diagonal pointers to sparse matrix structure. | |||
1532 | */ | |||
1533 | PetscErrorCode MatMarkDiagonal_SeqAIJ(Mat A) | |||
1534 | { | |||
1535 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1536 | PetscErrorCode ierr; | |||
1537 | PetscInt i,j,m = A->rmap->n; | |||
1538 | ||||
1539 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1539; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1540 | if (!a->diag) { | |||
1541 | ierr = PetscMalloc1(m,&a->diag)PetscMallocA(1,PETSC_FALSE,1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m)*sizeof(**(&a->diag)),(&a->diag));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1542 | ierr = PetscLogObjectMemory((PetscObject)A, m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1542,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1543 | } | |||
1544 | for (i=0; i<A->rmap->n; i++) { | |||
1545 | a->diag[i] = a->i[i+1]; | |||
1546 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
1547 | if (a->j[j] == i) { | |||
1548 | a->diag[i] = j; | |||
1549 | break; | |||
1550 | } | |||
1551 | } | |||
1552 | } | |||
1553 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1554 | } | |||
1555 | ||||
1556 | PetscErrorCode MatShift_SeqAIJ(Mat A,PetscScalar v) | |||
1557 | { | |||
1558 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1559 | const PetscInt *diag = (const PetscInt*)a->diag; | |||
1560 | const PetscInt *ii = (const PetscInt*) a->i; | |||
1561 | PetscInt i,*mdiag = NULL((void*)0); | |||
1562 | PetscErrorCode ierr; | |||
1563 | PetscInt cnt = 0; /* how many diagonals are missing */ | |||
1564 | ||||
1565 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1565; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1566 | if (!A->preallocated || !a->nz) { | |||
1567 | ierr = MatSeqAIJSetPreallocation(A,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1567,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1568 | ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1569 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1570 | } | |||
1571 | ||||
1572 | if (a->diagonaldense) { | |||
1573 | cnt = 0; | |||
1574 | } else { | |||
1575 | ierr = PetscCalloc1(A->rmap->n,&mdiag)PetscMallocA(1,PETSC_TRUE,1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(A->rmap->n)*sizeof(**(&mdiag)),(&mdiag ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1576 | for (i=0; i<A->rmap->n; i++) { | |||
1577 | if (diag[i] >= ii[i+1]) { | |||
1578 | cnt++; | |||
1579 | mdiag[i] = 1; | |||
1580 | } | |||
1581 | } | |||
1582 | } | |||
1583 | if (!cnt) { | |||
1584 | ierr = MatShift_Basic(A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1585 | } else { | |||
1586 | PetscScalar *olda = a->a; /* preserve pointers to current matrix nonzeros structure and values */ | |||
1587 | PetscInt *oldj = a->j, *oldi = a->i; | |||
1588 | PetscBool singlemalloc = a->singlemalloc,free_a = a->free_a,free_ij = a->free_ij; | |||
1589 | ||||
1590 | a->a = NULL((void*)0); | |||
1591 | a->j = NULL((void*)0); | |||
1592 | a->i = NULL((void*)0); | |||
1593 | /* increase the values in imax for each row where a diagonal is being inserted then reallocate the matrix data structures */ | |||
1594 | for (i=0; i<A->rmap->n; i++) { | |||
1595 | a->imax[i] += mdiag[i]; | |||
1596 | a->imax[i] = PetscMin(a->imax[i],A->cmap->n)(((a->imax[i])<(A->cmap->n)) ? (a->imax[i]) : ( A->cmap->n)); | |||
1597 | } | |||
1598 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,0,a->imax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1599 | ||||
1600 | /* copy old values into new matrix data structure */ | |||
1601 | for (i=0; i<A->rmap->n; i++) { | |||
1602 | ierr = MatSetValues(A,1,&i,a->imax[i] - mdiag[i],&oldj[oldi[i]],&olda[oldi[i]],ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1602,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1603 | if (i < A->cmap->n) { | |||
1604 | ierr = MatSetValue(A,i,i,v,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1605 | } | |||
1606 | } | |||
1607 | ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1607,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1608 | ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1609 | if (singlemalloc) { | |||
1610 | ierr = PetscFree3(olda,oldj,oldi)PetscFreeA(3,1610,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(olda),&(oldj),&(oldi));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1610,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1611 | } else { | |||
1612 | if (free_a) {ierr = PetscFree(olda)((*PetscTrFree)((void*)(olda),1612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((olda) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
1613 | if (free_ij) {ierr = PetscFree(oldj)((*PetscTrFree)((void*)(oldj),1613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((oldj) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
1614 | if (free_ij) {ierr = PetscFree(oldi)((*PetscTrFree)((void*)(oldi),1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((oldi) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
1615 | } | |||
1616 | } | |||
1617 | ierr = PetscFree(mdiag)((*PetscTrFree)((void*)(mdiag),1617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((mdiag) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1618 | a->diagonaldense = PETSC_TRUE; | |||
1619 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1620 | } | |||
1621 | ||||
1622 | /* | |||
1623 | Checks for missing diagonals | |||
1624 | */ | |||
1625 | PetscErrorCode MatMissingDiagonal_SeqAIJ(Mat A,PetscBool *missing,PetscInt *d) | |||
1626 | { | |||
1627 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1628 | PetscInt *diag,*ii = a->i,i; | |||
1629 | PetscErrorCode ierr; | |||
1630 | ||||
1631 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1631; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1632 | *missing = PETSC_FALSE; | |||
1633 | if (A->rmap->n > 0 && !ii) { | |||
1634 | *missing = PETSC_TRUE; | |||
1635 | if (d) *d = 0; | |||
1636 | ierr = PetscInfo(A,"Matrix has no entries therefore is missing diagonal\n")PetscInfo_Private(__func__,A,"Matrix has no entries therefore is missing diagonal\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1637 | } else { | |||
1638 | PetscInt n; | |||
1639 | n = PetscMin(A->rmap->n, A->cmap->n)(((A->rmap->n)<(A->cmap->n)) ? (A->rmap-> n) : (A->cmap->n)); | |||
1640 | diag = a->diag; | |||
1641 | for (i=0; i<n; i++) { | |||
1642 | if (diag[i] >= ii[i+1]) { | |||
1643 | *missing = PETSC_TRUE; | |||
1644 | if (d) *d = i; | |||
1645 | ierr = PetscInfo1(A,"Matrix is missing diagonal number %D\n",i)PetscInfo_Private(__func__,A,"Matrix is missing diagonal number %D\n" ,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1645,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1646 | break; | |||
1647 | } | |||
1648 | } | |||
1649 | } | |||
1650 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1651 | } | |||
1652 | ||||
1653 | #include <petscblaslapack.h> | |||
1654 | #include <petsc/private/kernels/blockinvert.h> | |||
1655 | ||||
1656 | /* | |||
1657 | Note that values is allocated externally by the PC and then passed into this routine | |||
1658 | */ | |||
1659 | PetscErrorCode MatInvertVariableBlockDiagonal_SeqAIJ(Mat A,PetscInt nblocks,const PetscInt *bsizes,PetscScalar *diag) | |||
1660 | { | |||
1661 | PetscErrorCode ierr; | |||
1662 | PetscInt n = A->rmap->n, i, ncnt = 0, *indx,j,bsizemax = 0,*v_pivots; | |||
1663 | PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE; | |||
1664 | const PetscReal shift = 0.0; | |||
1665 | PetscInt ipvt[5]; | |||
1666 | PetscScalar work[25],*v_work; | |||
1667 | ||||
1668 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1668; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1669 | allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE); | |||
1670 | for (i=0; i<nblocks; i++) ncnt += bsizes[i]; | |||
1671 | if (ncnt != n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Total blocksizes %D doesn't match number matrix rows %D",ncnt,n)do {if (__builtin_expect(!!(60),0)) {PetscError(((MPI_Comm)0x44000001 ),1671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 60);}} while (0); | |||
1672 | for (i=0; i<nblocks; i++) { | |||
1673 | bsizemax = PetscMax(bsizemax,bsizes[i])(((bsizemax)<(bsizes[i])) ? (bsizes[i]) : (bsizemax)); | |||
1674 | } | |||
1675 | ierr = PetscMalloc1(bsizemax,&indx)PetscMallocA(1,PETSC_FALSE,1675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(bsizemax)*sizeof(**(&indx)),(&indx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1676 | if (bsizemax > 7) { | |||
1677 | ierr = PetscMalloc2(bsizemax,&v_work,bsizemax,&v_pivots)PetscMallocA(2,PETSC_FALSE,1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(bsizemax)*sizeof(**(&v_work)),(&v_work),(size_t )(bsizemax)*sizeof(**(&v_pivots)),(&v_pivots));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1678 | } | |||
1679 | ncnt = 0; | |||
1680 | for (i=0; i<nblocks; i++) { | |||
1681 | for (j=0; j<bsizes[i]; j++) indx[j] = ncnt+j; | |||
1682 | ierr = MatGetValues(A,bsizes[i],indx,bsizes[i],indx,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1683 | switch (bsizes[i]) { | |||
1684 | case 1: | |||
1685 | *diag = 1.0/(*diag); | |||
1686 | break; | |||
1687 | case 2: | |||
1688 | ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1689 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1690 | ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1691 | break; | |||
1692 | case 3: | |||
1693 | ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1694 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1695 | ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1695,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1696 | break; | |||
1697 | case 4: | |||
1698 | ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1699 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1700 | ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1700,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1701 | break; | |||
1702 | case 5: | |||
1703 | ierr = PetscKernel_A_gets_inverse_A_5(diag,ipvt,work,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1703,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1704 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1705 | ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1705,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1706 | break; | |||
1707 | case 6: | |||
1708 | ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1708,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1709 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1710 | ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1710,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1711 | break; | |||
1712 | case 7: | |||
1713 | ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1713,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1714 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1715 | ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1715,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1716 | break; | |||
1717 | default: | |||
1718 | ierr = PetscKernel_A_gets_inverse_A(bsizes[i],diag,v_pivots,v_work,allowzeropivot,&zeropivotdetected)(PetscLINPACKgefa((diag),(bsizes[i]),(v_pivots),(allowzeropivot ),(&zeropivotdetected)) || PetscLINPACKgedi((diag),(bsizes [i]),(v_pivots),(v_work)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1718,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1719 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1720 | ierr = PetscKernel_A_gets_transpose_A_N(diag,bsizes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1720,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1721 | } | |||
1722 | ncnt += bsizes[i]; | |||
1723 | diag += bsizes[i]*bsizes[i]; | |||
1724 | } | |||
1725 | if (bsizemax > 7) { | |||
1726 | ierr = PetscFree2(v_work,v_pivots)PetscFreeA(2,1726,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(v_work),&(v_pivots));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1726,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1727 | } | |||
1728 | ierr = PetscFree(indx)((*PetscTrFree)((void*)(indx),1728,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((indx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1728,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1729 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1730 | } | |||
1731 | ||||
1732 | /* | |||
1733 | Negative shift indicates do not generate an error if there is a zero diagonal, just invert it anyways | |||
1734 | */ | |||
1735 | PetscErrorCode MatInvertDiagonal_SeqAIJ(Mat A,PetscScalar omega,PetscScalar fshift) | |||
1736 | { | |||
1737 | Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data; | |||
1738 | PetscErrorCode ierr; | |||
1739 | PetscInt i,*diag,m = A->rmap->n; | |||
1740 | MatScalar *v = a->a; | |||
1741 | PetscScalar *idiag,*mdiag; | |||
1742 | ||||
1743 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1743; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1744 | if (a->idiagvalid) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1745 | ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1745,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1746 | diag = a->diag; | |||
1747 | if (!a->idiag) { | |||
1748 | ierr = PetscMalloc3(m,&a->idiag,m,&a->mdiag,m,&a->ssor_work)PetscMallocA(3,PETSC_FALSE,1748,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m)*sizeof(**(&a->idiag)),(&a->idiag), (size_t)(m)*sizeof(**(&a->mdiag)),(&a->mdiag),( size_t)(m)*sizeof(**(&a->ssor_work)),(&a->ssor_work ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1748,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1749 | ierr = PetscLogObjectMemory((PetscObject)A, 3*m*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1749,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1750 | v = a->a; | |||
1751 | } | |||
1752 | mdiag = a->mdiag; | |||
1753 | idiag = a->idiag; | |||
1754 | ||||
1755 | if (omega == 1.0 && PetscRealPart(fshift)(fshift) <= 0.0) { | |||
1756 | for (i=0; i<m; i++) { | |||
1757 | mdiag[i] = v[diag[i]]; | |||
1758 | if (!PetscAbsScalar(mdiag[i])) { /* zero diagonal */ | |||
1759 | if (PetscRealPart(fshift)(fshift)) { | |||
1760 | ierr = PetscInfo1(A,"Zero diagonal on row %D\n",i)PetscInfo_Private(__func__,A,"Zero diagonal on row %D\n",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1760,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1761 | A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
1762 | A->factorerror_zeropivot_value = 0.0; | |||
1763 | A->factorerror_zeropivot_row = i; | |||
1764 | } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Zero diagonal on row %D",i)return PetscError(((MPI_Comm)0x44000001),1764,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,75,PETSC_ERROR_INITIAL,"Zero diagonal on row %D",i); | |||
1765 | } | |||
1766 | idiag[i] = 1.0/v[diag[i]]; | |||
1767 | } | |||
1768 | ierr = PetscLogFlops(m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1768,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1769 | } else { | |||
1770 | for (i=0; i<m; i++) { | |||
1771 | mdiag[i] = v[diag[i]]; | |||
1772 | idiag[i] = omega/(fshift + v[diag[i]]); | |||
1773 | } | |||
1774 | ierr = PetscLogFlops(2.0*m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1774,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1775 | } | |||
1776 | a->idiagvalid = PETSC_TRUE; | |||
1777 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1778 | } | |||
1779 | ||||
1780 | #include <../src/mat/impls/aij/seq/ftn-kernels/frelax.h> | |||
1781 | PetscErrorCode MatSOR_SeqAIJ(Mat A,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx) | |||
1782 | { | |||
1783 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1784 | PetscScalar *x,d,sum,*t,scale; | |||
1785 | const MatScalar *v,*idiag=0,*mdiag; | |||
1786 | const PetscScalar *b, *bs,*xb, *ts; | |||
1787 | PetscErrorCode ierr; | |||
1788 | PetscInt n,m = A->rmap->n,i; | |||
1789 | const PetscInt *idx,*diag; | |||
1790 | ||||
1791 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1791; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1792 | its = its*lits; | |||
1793 | ||||
1794 | if (fshift != a->fshift || omega != a->omega) a->idiagvalid = PETSC_FALSE; /* must recompute idiag[] */ | |||
1795 | if (!a->idiagvalid) {ierr = MatInvertDiagonal_SeqAIJ(A,omega,fshift);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
1796 | a->fshift = fshift; | |||
1797 | a->omega = omega; | |||
1798 | ||||
1799 | diag = a->diag; | |||
1800 | t = a->ssor_work; | |||
1801 | idiag = a->idiag; | |||
1802 | mdiag = a->mdiag; | |||
1803 | ||||
1804 | ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1805 | ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1806 | /* We count flops by assuming the upper triangular and lower triangular parts have the same number of nonzeros */ | |||
1807 | if (flag == SOR_APPLY_UPPER) { | |||
1808 | /* apply (U + D/omega) to the vector */ | |||
1809 | bs = b; | |||
1810 | for (i=0; i<m; i++) { | |||
1811 | d = fshift + mdiag[i]; | |||
1812 | n = a->i[i+1] - diag[i] - 1; | |||
1813 | idx = a->j + diag[i] + 1; | |||
1814 | v = a->a + diag[i] + 1; | |||
1815 | sum = b[i]*d/omega; | |||
1816 | PetscSparseDensePlusDot(sum,bs,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum += v[__i] * bs [idx[__i]];}; | |||
1817 | x[i] = sum; | |||
1818 | } | |||
1819 | ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1820 | ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1820,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1821 | ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1821,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1822 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1823 | } | |||
1824 | ||||
1825 | if (flag == SOR_APPLY_LOWER) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SOR_APPLY_LOWER is not implemented")return PetscError(((MPI_Comm)0x44000001),1825,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"SOR_APPLY_LOWER is not implemented"); | |||
1826 | else if (flag & SOR_EISENSTAT) { | |||
1827 | /* Let A = L + U + D; where L is lower trianglar, | |||
1828 | U is upper triangular, E = D/omega; This routine applies | |||
1829 | ||||
1830 | (L + E)^{-1} A (U + E)^{-1} | |||
1831 | ||||
1832 | to a vector efficiently using Eisenstat's trick. | |||
1833 | */ | |||
1834 | scale = (2.0/omega) - 1.0; | |||
1835 | ||||
1836 | /* x = (E + U)^{-1} b */ | |||
1837 | for (i=m-1; i>=0; i--) { | |||
1838 | n = a->i[i+1] - diag[i] - 1; | |||
1839 | idx = a->j + diag[i] + 1; | |||
1840 | v = a->a + diag[i] + 1; | |||
1841 | sum = b[i]; | |||
1842 | PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x [idx[__i]];}; | |||
1843 | x[i] = sum*idiag[i]; | |||
1844 | } | |||
1845 | ||||
1846 | /* t = b - (2*E - D)x */ | |||
1847 | v = a->a; | |||
1848 | for (i=0; i<m; i++) t[i] = b[i] - scale*(v[*diag++])*x[i]; | |||
1849 | ||||
1850 | /* t = (E + L)^{-1}t */ | |||
1851 | ts = t; | |||
1852 | diag = a->diag; | |||
1853 | for (i=0; i<m; i++) { | |||
1854 | n = diag[i] - a->i[i]; | |||
1855 | idx = a->j + a->i[i]; | |||
1856 | v = a->a + a->i[i]; | |||
1857 | sum = t[i]; | |||
1858 | PetscSparseDenseMinusDot(sum,ts,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * ts [idx[__i]];}; | |||
1859 | t[i] = sum*idiag[i]; | |||
1860 | /* x = x + t */ | |||
1861 | x[i] += t[i]; | |||
1862 | } | |||
1863 | ||||
1864 | ierr = PetscLogFlops(6.0*m-1 + 2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1865 | ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1865,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1866 | ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1867 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1868 | } | |||
1869 | if (flag & SOR_ZERO_INITIAL_GUESS) { | |||
1870 | if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) { | |||
1871 | for (i=0; i<m; i++) { | |||
1872 | n = diag[i] - a->i[i]; | |||
1873 | idx = a->j + a->i[i]; | |||
1874 | v = a->a + a->i[i]; | |||
1875 | sum = b[i]; | |||
1876 | PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x [idx[__i]];}; | |||
1877 | t[i] = sum; | |||
1878 | x[i] = sum*idiag[i]; | |||
1879 | } | |||
1880 | xb = t; | |||
1881 | ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1881,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1882 | } else xb = b; | |||
1883 | if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) { | |||
1884 | for (i=m-1; i>=0; i--) { | |||
1885 | n = a->i[i+1] - diag[i] - 1; | |||
1886 | idx = a->j + diag[i] + 1; | |||
1887 | v = a->a + diag[i] + 1; | |||
1888 | sum = xb[i]; | |||
1889 | PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x [idx[__i]];}; | |||
1890 | if (xb == b) { | |||
1891 | x[i] = sum*idiag[i]; | |||
1892 | } else { | |||
1893 | x[i] = (1-omega)*x[i] + sum*idiag[i]; /* omega in idiag */ | |||
1894 | } | |||
1895 | } | |||
1896 | ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1896,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); /* assumes 1/2 in upper */ | |||
1897 | } | |||
1898 | its--; | |||
1899 | } | |||
1900 | while (its--) { | |||
1901 | if (flag & SOR_FORWARD_SWEEP || flag & SOR_LOCAL_FORWARD_SWEEP) { | |||
1902 | for (i=0; i<m; i++) { | |||
1903 | /* lower */ | |||
1904 | n = diag[i] - a->i[i]; | |||
1905 | idx = a->j + a->i[i]; | |||
1906 | v = a->a + a->i[i]; | |||
1907 | sum = b[i]; | |||
1908 | PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x [idx[__i]];}; | |||
1909 | t[i] = sum; /* save application of the lower-triangular part */ | |||
1910 | /* upper */ | |||
1911 | n = a->i[i+1] - diag[i] - 1; | |||
1912 | idx = a->j + diag[i] + 1; | |||
1913 | v = a->a + diag[i] + 1; | |||
1914 | PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x [idx[__i]];}; | |||
1915 | x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */ | |||
1916 | } | |||
1917 | xb = t; | |||
1918 | ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1918,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1919 | } else xb = b; | |||
1920 | if (flag & SOR_BACKWARD_SWEEP || flag & SOR_LOCAL_BACKWARD_SWEEP) { | |||
1921 | for (i=m-1; i>=0; i--) { | |||
1922 | sum = xb[i]; | |||
1923 | if (xb == b) { | |||
1924 | /* whole matrix (no checkpointing available) */ | |||
1925 | n = a->i[i+1] - a->i[i]; | |||
1926 | idx = a->j + a->i[i]; | |||
1927 | v = a->a + a->i[i]; | |||
1928 | PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x [idx[__i]];}; | |||
1929 | x[i] = (1. - omega)*x[i] + (sum + mdiag[i]*x[i])*idiag[i]; | |||
1930 | } else { /* lower-triangular part has been saved, so only apply upper-triangular */ | |||
1931 | n = a->i[i+1] - diag[i] - 1; | |||
1932 | idx = a->j + diag[i] + 1; | |||
1933 | v = a->a + diag[i] + 1; | |||
1934 | PetscSparseDenseMinusDot(sum,x,v,idx,n){ PetscInt __i; for (__i=0; __i<n; __i++) sum -= v[__i] * x [idx[__i]];}; | |||
1935 | x[i] = (1. - omega)*x[i] + sum*idiag[i]; /* omega in idiag */ | |||
1936 | } | |||
1937 | } | |||
1938 | if (xb == b) { | |||
1939 | ierr = PetscLogFlops(2.0*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1939,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1940 | } else { | |||
1941 | ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1941,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); /* assumes 1/2 in upper */ | |||
1942 | } | |||
1943 | } | |||
1944 | } | |||
1945 | ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1945,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1946 | ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1946,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1947 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1948 | } | |||
1949 | ||||
1950 | ||||
1951 | PetscErrorCode MatGetInfo_SeqAIJ(Mat A,MatInfoType flag,MatInfo *info) | |||
1952 | { | |||
1953 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1954 | ||||
1955 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1955; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1956 | info->block_size = 1.0; | |||
1957 | info->nz_allocated = (double)a->maxnz; | |||
1958 | info->nz_used = (double)a->nz; | |||
1959 | info->nz_unneeded = (double)(a->maxnz - a->nz); | |||
1960 | info->assemblies = (double)A->num_ass; | |||
1961 | info->mallocs = (double)A->info.mallocs; | |||
1962 | info->memory = ((PetscObject)A)->mem; | |||
1963 | if (A->factortype) { | |||
1964 | info->fill_ratio_given = A->info.fill_ratio_given; | |||
1965 | info->fill_ratio_needed = A->info.fill_ratio_needed; | |||
1966 | info->factor_mallocs = A->info.factor_mallocs; | |||
1967 | } else { | |||
1968 | info->fill_ratio_given = 0; | |||
1969 | info->fill_ratio_needed = 0; | |||
1970 | info->factor_mallocs = 0; | |||
1971 | } | |||
1972 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1973 | } | |||
1974 | ||||
1975 | PetscErrorCode MatZeroRows_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b) | |||
1976 | { | |||
1977 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
1978 | PetscInt i,m = A->rmap->n - 1; | |||
1979 | PetscErrorCode ierr; | |||
1980 | const PetscScalar *xx; | |||
1981 | PetscScalar *bb; | |||
1982 | PetscInt d = 0; | |||
1983 | ||||
1984 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 1984; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1985 | if (x && b) { | |||
1986 | ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1987 | ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1987,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1988 | for (i=0; i<N; i++) { | |||
1989 | if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),1989,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i]); | |||
1990 | if (rows[i] >= A->cmap->n) continue; | |||
1991 | bb[rows[i]] = diag*xx[rows[i]]; | |||
1992 | } | |||
1993 | ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1993,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1994 | ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),1994,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
1995 | } | |||
1996 | ||||
1997 | if (a->keepnonzeropattern) { | |||
1998 | for (i=0; i<N; i++) { | |||
1999 | if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),1999,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i]); | |||
2000 | ierr = PetscArrayzero(&a->a[a->i[rows[i]]],a->ilen[rows[i]])PetscMemzero(&a->a[a->i[rows[i]]],(a->ilen[rows[ i]])*sizeof(*(&a->a[a->i[rows[i]]])));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2000,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2001 | } | |||
2002 | if (diag != 0.0) { | |||
2003 | for (i=0; i<N; i++) { | |||
2004 | d = rows[i]; | |||
2005 | if (rows[i] >= A->cmap->n) continue; | |||
2006 | if (a->diag[d] >= a->i[d+1]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix is missing diagonal entry in the zeroed row %D",d)return PetscError(((MPI_Comm)0x44000001),2006,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Matrix is missing diagonal entry in the zeroed row %D" ,d); | |||
2007 | } | |||
2008 | for (i=0; i<N; i++) { | |||
2009 | if (rows[i] >= A->cmap->n) continue; | |||
2010 | a->a[a->diag[rows[i]]] = diag; | |||
2011 | } | |||
2012 | } | |||
2013 | } else { | |||
2014 | if (diag != 0.0) { | |||
2015 | for (i=0; i<N; i++) { | |||
2016 | if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),2016,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i]); | |||
2017 | if (a->ilen[rows[i]] > 0) { | |||
2018 | if (rows[i] >= A->cmap->n) { | |||
2019 | a->ilen[rows[i]] = 0; | |||
2020 | } else { | |||
2021 | a->ilen[rows[i]] = 1; | |||
2022 | a->a[a->i[rows[i]]] = diag; | |||
2023 | a->j[a->i[rows[i]]] = rows[i]; | |||
2024 | } | |||
2025 | } else if (rows[i] < A->cmap->n) { /* in case row was completely empty */ | |||
2026 | ierr = MatSetValues_SeqAIJ(A,1,&rows[i],1,&rows[i],&diag,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2026,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2027 | } | |||
2028 | } | |||
2029 | } else { | |||
2030 | for (i=0; i<N; i++) { | |||
2031 | if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),2031,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i]); | |||
2032 | a->ilen[rows[i]] = 0; | |||
2033 | } | |||
2034 | } | |||
2035 | A->nonzerostate++; | |||
2036 | } | |||
2037 | ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2037,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2038 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2039 | } | |||
2040 | ||||
2041 | PetscErrorCode MatZeroRowsColumns_SeqAIJ(Mat A,PetscInt N,const PetscInt rows[],PetscScalar diag,Vec x,Vec b) | |||
2042 | { | |||
2043 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2044 | PetscInt i,j,m = A->rmap->n - 1,d = 0; | |||
2045 | PetscErrorCode ierr; | |||
2046 | PetscBool missing,*zeroed,vecs = PETSC_FALSE; | |||
2047 | const PetscScalar *xx; | |||
2048 | PetscScalar *bb; | |||
2049 | ||||
2050 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2050; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2051 | if (x && b) { | |||
2052 | ierr = VecGetArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2052,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2053 | ierr = VecGetArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2053,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2054 | vecs = PETSC_TRUE; | |||
2055 | } | |||
2056 | ierr = PetscCalloc1(A->rmap->n,&zeroed)PetscMallocA(1,PETSC_TRUE,2056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(A->rmap->n)*sizeof(**(&zeroed)),(&zeroed ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2057 | for (i=0; i<N; i++) { | |||
2058 | if (rows[i] < 0 || rows[i] > m) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"row %D out of range", rows[i])return PetscError(((MPI_Comm)0x44000001),2058,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"row %D out of range",rows[i]); | |||
2059 | ierr = PetscArrayzero(&a->a[a->i[rows[i]]],a->ilen[rows[i]])PetscMemzero(&a->a[a->i[rows[i]]],(a->ilen[rows[ i]])*sizeof(*(&a->a[a->i[rows[i]]])));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2059,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2060 | ||||
2061 | zeroed[rows[i]] = PETSC_TRUE; | |||
2062 | } | |||
2063 | for (i=0; i<A->rmap->n; i++) { | |||
2064 | if (!zeroed[i]) { | |||
2065 | for (j=a->i[i]; j<a->i[i+1]; j++) { | |||
2066 | if (a->j[j] < A->rmap->n && zeroed[a->j[j]]) { | |||
2067 | if (vecs) bb[i] -= a->a[j]*xx[a->j[j]]; | |||
2068 | a->a[j] = 0.0; | |||
2069 | } | |||
2070 | } | |||
2071 | } else if (vecs && i < A->cmap->N) bb[i] = diag*xx[i]; | |||
2072 | } | |||
2073 | if (x && b) { | |||
2074 | ierr = VecRestoreArrayRead(x,&xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2074,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2075 | ierr = VecRestoreArray(b,&bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2075,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2076 | } | |||
2077 | ierr = PetscFree(zeroed)((*PetscTrFree)((void*)(zeroed),2077,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((zeroed) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2077,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2078 | if (diag != 0.0) { | |||
2079 | ierr = MatMissingDiagonal_SeqAIJ(A,&missing,&d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2079,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2080 | if (missing) { | |||
2081 | for (i=0; i<N; i++) { | |||
2082 | if (rows[i] >= A->cmap->N) continue; | |||
2083 | if (a->nonew && rows[i] >= d) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Matrix is missing diagonal entry in row %D (%D)",d,rows[i])do {if (__builtin_expect(!!(73),0)) {PetscError(((MPI_Comm)0x44000001 ),2083,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 73);}} while (0); | |||
2084 | ierr = MatSetValues_SeqAIJ(A,1,&rows[i],1,&rows[i],&diag,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2084,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2085 | } | |||
2086 | } else { | |||
2087 | for (i=0; i<N; i++) { | |||
2088 | a->a[a->diag[rows[i]]] = diag; | |||
2089 | } | |||
2090 | } | |||
2091 | } | |||
2092 | ierr = (*A->ops->assemblyend)(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2092,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2093 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2094 | } | |||
2095 | ||||
2096 | PetscErrorCode MatGetRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
2097 | { | |||
2098 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2099 | PetscInt *itmp; | |||
2100 | ||||
2101 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2101; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2102 | 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),2102,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"Row %D out of range",row); | |||
2103 | ||||
2104 | *nz = a->i[row+1] - a->i[row]; | |||
2105 | if (v) *v = a->a + a->i[row]; | |||
2106 | if (idx) { | |||
2107 | itmp = a->j + a->i[row]; | |||
2108 | if (*nz) *idx = itmp; | |||
2109 | else *idx = 0; | |||
2110 | } | |||
2111 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2112 | } | |||
2113 | ||||
2114 | /* remove this function? */ | |||
2115 | PetscErrorCode MatRestoreRow_SeqAIJ(Mat A,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
2116 | { | |||
2117 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2117; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2118 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2119 | } | |||
2120 | ||||
2121 | PetscErrorCode MatNorm_SeqAIJ(Mat A,NormType type,PetscReal *nrm) | |||
2122 | { | |||
2123 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2124 | MatScalar *v = a->a; | |||
2125 | PetscReal sum = 0.0; | |||
2126 | PetscErrorCode ierr; | |||
2127 | PetscInt i,j; | |||
2128 | ||||
2129 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2129; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2130 | if (type == NORM_FROBENIUS) { | |||
2131 | #if defined(PETSC_USE_REAL___FP16) | |||
2132 | PetscBLASInt one = 1,nz = a->nz; | |||
2133 | *nrm = BLASnrm2_dnrm2_(&nz,v,&one); | |||
2134 | #else | |||
2135 | for (i=0; i<a->nz; i++) { | |||
2136 | sum += PetscRealPart(PetscConj(*v)*(*v))((*v)*(*v)); v++; | |||
2137 | } | |||
2138 | *nrm = PetscSqrtReal(sum)sqrt(sum); | |||
2139 | #endif | |||
2140 | ierr = PetscLogFlops(2*a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2140,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2141 | } else if (type == NORM_1) { | |||
2142 | PetscReal *tmp; | |||
2143 | PetscInt *jj = a->j; | |||
2144 | ierr = PetscCalloc1(A->cmap->n+1,&tmp)PetscMallocA(1,PETSC_TRUE,2144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(A->cmap->n+1)*sizeof(**(&tmp)),(&tmp) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2145 | *nrm = 0.0; | |||
2146 | for (j=0; j<a->nz; j++) { | |||
2147 | tmp[*jj++] += PetscAbsScalar(*v); v++; | |||
2148 | } | |||
2149 | for (j=0; j<A->cmap->n; j++) { | |||
2150 | if (tmp[j] > *nrm) *nrm = tmp[j]; | |||
2151 | } | |||
2152 | ierr = PetscFree(tmp)((*PetscTrFree)((void*)(tmp),2152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((tmp) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2153 | ierr = PetscLogFlops(PetscMax(a->nz-1,0)(((a->nz-1)<(0)) ? (0) : (a->nz-1)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2154 | } else if (type == NORM_INFINITY) { | |||
2155 | *nrm = 0.0; | |||
2156 | for (j=0; j<A->rmap->n; j++) { | |||
2157 | v = a->a + a->i[j]; | |||
2158 | sum = 0.0; | |||
2159 | for (i=0; i<a->i[j+1]-a->i[j]; i++) { | |||
2160 | sum += PetscAbsScalar(*v); v++; | |||
2161 | } | |||
2162 | if (sum > *nrm) *nrm = sum; | |||
2163 | } | |||
2164 | ierr = PetscLogFlops(PetscMax(a->nz-1,0)(((a->nz-1)<(0)) ? (0) : (a->nz-1)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2165 | } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for two norm")return PetscError(((MPI_Comm)0x44000001),2165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"No support for two norm"); | |||
2166 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2167 | } | |||
2168 | ||||
2169 | /* Merged from MatGetSymbolicTranspose_SeqAIJ() - replace MatGetSymbolicTranspose_SeqAIJ()? */ | |||
2170 | PetscErrorCode MatTransposeSymbolic_SeqAIJ(Mat A,Mat *B) | |||
2171 | { | |||
2172 | PetscErrorCode ierr; | |||
2173 | PetscInt i,j,anzj; | |||
2174 | Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data,*b; | |||
2175 | PetscInt an=A->cmap->N,am=A->rmap->N; | |||
2176 | PetscInt *ati,*atj,*atfill,*ai=a->i,*aj=a->j; | |||
2177 | ||||
2178 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2178; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2179 | /* Allocate space for symbolic transpose info and work array */ | |||
2180 | ierr = PetscCalloc1(an+1,&ati)PetscMallocA(1,PETSC_TRUE,2180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(an+1)*sizeof(**(&ati)),(&ati));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2181 | ierr = PetscMalloc1(ai[am],&atj)PetscMallocA(1,PETSC_FALSE,2181,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(ai[am])*sizeof(**(&atj)),(&atj));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2181,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2182 | ierr = PetscMalloc1(an,&atfill)PetscMallocA(1,PETSC_FALSE,2182,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(an)*sizeof(**(&atfill)),(&atfill));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2182,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2183 | ||||
2184 | /* Walk through aj and count ## of non-zeros in each row of A^T. */ | |||
2185 | /* Note: offset by 1 for fast conversion into csr format. */ | |||
2186 | for (i=0;i<ai[am];i++) ati[aj[i]+1] += 1; | |||
2187 | /* Form ati for csr format of A^T. */ | |||
2188 | for (i=0;i<an;i++) ati[i+1] += ati[i]; | |||
2189 | ||||
2190 | /* Copy ati into atfill so we have locations of the next free space in atj */ | |||
2191 | ierr = PetscArraycpy(atfill,ati,an)((sizeof(*(atfill)) != sizeof(*(ati))) || PetscMemcpy(atfill, ati,(an)*sizeof(*(atfill))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2192 | ||||
2193 | /* Walk through A row-wise and mark nonzero entries of A^T. */ | |||
2194 | for (i=0;i<am;i++) { | |||
2195 | anzj = ai[i+1] - ai[i]; | |||
2196 | for (j=0;j<anzj;j++) { | |||
2197 | atj[atfill[*aj]] = i; | |||
2198 | atfill[*aj++] += 1; | |||
2199 | } | |||
2200 | } | |||
2201 | ||||
2202 | /* Clean up temporary space and complete requests. */ | |||
2203 | ierr = PetscFree(atfill)((*PetscTrFree)((void*)(atfill),2203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((atfill) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2204 | ierr = MatCreateSeqAIJWithArrays(PetscObjectComm((PetscObject)A),an,am,ati,atj,NULL((void*)0),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2205 | ierr = MatSetBlockSizes(*B,PetscAbs(A->cmap->bs)(((A->cmap->bs) >= 0) ? (A->cmap->bs) : (-(A-> cmap->bs))),PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A-> rmap->bs))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2206 | ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2207 | ||||
2208 | b = (Mat_SeqAIJ*)((*B)->data); | |||
2209 | b->free_a = PETSC_FALSE; | |||
2210 | b->free_ij = PETSC_TRUE; | |||
2211 | b->nonew = 0; | |||
2212 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2213 | } | |||
2214 | ||||
2215 | PetscErrorCode MatIsTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f) | |||
2216 | { | |||
2217 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data; | |||
2218 | PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr; | |||
2219 | MatScalar *va,*vb; | |||
2220 | PetscErrorCode ierr; | |||
2221 | PetscInt ma,na,mb,nb, i; | |||
2222 | ||||
2223 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2223; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2224 | ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2224,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2225 | ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2225,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2226 | if (ma!=nb || na!=mb) { | |||
2227 | *f = PETSC_FALSE; | |||
2228 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2229 | } | |||
2230 | aii = aij->i; bii = bij->i; | |||
2231 | adx = aij->j; bdx = bij->j; | |||
2232 | va = aij->a; vb = bij->a; | |||
2233 | ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(ma)*sizeof(**(&aptr)),(&aptr));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2234 | ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(mb)*sizeof(**(&bptr)),(&bptr));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2235 | for (i=0; i<ma; i++) aptr[i] = aii[i]; | |||
2236 | for (i=0; i<mb; i++) bptr[i] = bii[i]; | |||
2237 | ||||
2238 | *f = PETSC_TRUE; | |||
2239 | for (i=0; i<ma; i++) { | |||
2240 | while (aptr[i]<aii[i+1]) { | |||
2241 | PetscInt idc,idr; | |||
2242 | PetscScalar vc,vr; | |||
2243 | /* column/row index/value */ | |||
2244 | idc = adx[aptr[i]]; | |||
2245 | idr = bdx[bptr[idc]]; | |||
2246 | vc = va[aptr[i]]; | |||
2247 | vr = vb[bptr[idc]]; | |||
2248 | if (i!=idr || PetscAbsScalar(vc-vr) > tol) { | |||
2249 | *f = PETSC_FALSE; | |||
2250 | goto done; | |||
2251 | } else { | |||
2252 | aptr[i]++; | |||
2253 | if (B || i!=idc) bptr[idc]++; | |||
2254 | } | |||
2255 | } | |||
2256 | } | |||
2257 | done: | |||
2258 | ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((aptr) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2259 | ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2259,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((bptr) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2259,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2260 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2261 | } | |||
2262 | ||||
2263 | PetscErrorCode MatIsHermitianTranspose_SeqAIJ(Mat A,Mat B,PetscReal tol,PetscBool *f) | |||
2264 | { | |||
2265 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*) A->data,*bij = (Mat_SeqAIJ*) B->data; | |||
2266 | PetscInt *adx,*bdx,*aii,*bii,*aptr,*bptr; | |||
2267 | MatScalar *va,*vb; | |||
2268 | PetscErrorCode ierr; | |||
2269 | PetscInt ma,na,mb,nb, i; | |||
2270 | ||||
2271 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2271; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2272 | ierr = MatGetSize(A,&ma,&na);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2273 | ierr = MatGetSize(B,&mb,&nb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2274 | if (ma!=nb || na!=mb) { | |||
2275 | *f = PETSC_FALSE; | |||
2276 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2277 | } | |||
2278 | aii = aij->i; bii = bij->i; | |||
2279 | adx = aij->j; bdx = bij->j; | |||
2280 | va = aij->a; vb = bij->a; | |||
2281 | ierr = PetscMalloc1(ma,&aptr)PetscMallocA(1,PETSC_FALSE,2281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(ma)*sizeof(**(&aptr)),(&aptr));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2282 | ierr = PetscMalloc1(mb,&bptr)PetscMallocA(1,PETSC_FALSE,2282,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(mb)*sizeof(**(&bptr)),(&bptr));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2282,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2283 | for (i=0; i<ma; i++) aptr[i] = aii[i]; | |||
2284 | for (i=0; i<mb; i++) bptr[i] = bii[i]; | |||
2285 | ||||
2286 | *f = PETSC_TRUE; | |||
2287 | for (i=0; i<ma; i++) { | |||
2288 | while (aptr[i]<aii[i+1]) { | |||
2289 | PetscInt idc,idr; | |||
2290 | PetscScalar vc,vr; | |||
2291 | /* column/row index/value */ | |||
2292 | idc = adx[aptr[i]]; | |||
2293 | idr = bdx[bptr[idc]]; | |||
2294 | vc = va[aptr[i]]; | |||
2295 | vr = vb[bptr[idc]]; | |||
2296 | if (i!=idr || PetscAbsScalar(vc-PetscConj(vr)(vr)) > tol) { | |||
2297 | *f = PETSC_FALSE; | |||
2298 | goto done; | |||
2299 | } else { | |||
2300 | aptr[i]++; | |||
2301 | if (B || i!=idc) bptr[idc]++; | |||
2302 | } | |||
2303 | } | |||
2304 | } | |||
2305 | done: | |||
2306 | ierr = PetscFree(aptr)((*PetscTrFree)((void*)(aptr),2306,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((aptr) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2306,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2307 | ierr = PetscFree(bptr)((*PetscTrFree)((void*)(bptr),2307,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((bptr) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2307,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2308 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2309 | } | |||
2310 | ||||
2311 | PetscErrorCode MatIsSymmetric_SeqAIJ(Mat A,PetscReal tol,PetscBool *f) | |||
2312 | { | |||
2313 | PetscErrorCode ierr; | |||
2314 | ||||
2315 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2315; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2316 | ierr = MatIsTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2316,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2317 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2318 | } | |||
2319 | ||||
2320 | PetscErrorCode MatIsHermitian_SeqAIJ(Mat A,PetscReal tol,PetscBool *f) | |||
2321 | { | |||
2322 | PetscErrorCode ierr; | |||
2323 | ||||
2324 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2324; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2325 | ierr = MatIsHermitianTranspose_SeqAIJ(A,A,tol,f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2325,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2326 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2327 | } | |||
2328 | ||||
2329 | PetscErrorCode MatDiagonalScale_SeqAIJ(Mat A,Vec ll,Vec rr) | |||
2330 | { | |||
2331 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2332 | const PetscScalar *l,*r; | |||
2333 | PetscScalar x; | |||
2334 | MatScalar *v; | |||
2335 | PetscErrorCode ierr; | |||
2336 | PetscInt i,j,m = A->rmap->n,n = A->cmap->n,M,nz = a->nz; | |||
2337 | const PetscInt *jj; | |||
2338 | ||||
2339 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2339; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2340 | if (ll) { | |||
2341 | /* The local size is used so that VecMPI can be passed to this routine | |||
2342 | by MatDiagonalScale_MPIAIJ */ | |||
2343 | ierr = VecGetLocalSize(ll,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2343,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2344 | if (m != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2344,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Left scaling vector wrong length"); | |||
2345 | ierr = VecGetArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2345,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2346 | v = a->a; | |||
2347 | for (i=0; i<m; i++) { | |||
2348 | x = l[i]; | |||
2349 | M = a->i[i+1] - a->i[i]; | |||
2350 | for (j=0; j<M; j++) (*v++) *= x; | |||
2351 | } | |||
2352 | ierr = VecRestoreArrayRead(ll,&l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2353 | ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2354 | } | |||
2355 | if (rr) { | |||
2356 | ierr = VecGetLocalSize(rr,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2356,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2357 | if (n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Right scaling vector wrong length")return PetscError(((MPI_Comm)0x44000001),2357,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Right scaling vector wrong length"); | |||
2358 | ierr = VecGetArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2359 | v = a->a; jj = a->j; | |||
2360 | for (i=0; i<nz; i++) (*v++) *= r[*jj++]; | |||
2361 | ierr = VecRestoreArrayRead(rr,&r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2362 | ierr = PetscLogFlops(nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2362,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2363 | } | |||
2364 | ierr = MatSeqAIJInvalidateDiagonal(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2364,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2365 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2366 | } | |||
2367 | ||||
2368 | PetscErrorCode MatCreateSubMatrix_SeqAIJ(Mat A,IS isrow,IS iscol,PetscInt csize,MatReuse scall,Mat *B) | |||
2369 | { | |||
2370 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*c; | |||
2371 | PetscErrorCode ierr; | |||
2372 | PetscInt *smap,i,k,kstart,kend,oldcols = A->cmap->n,*lens; | |||
2373 | PetscInt row,mat_i,*mat_j,tcol,first,step,*mat_ilen,sum,lensi; | |||
2374 | const PetscInt *irow,*icol; | |||
2375 | PetscInt nrows,ncols; | |||
2376 | PetscInt *starts,*j_new,*i_new,*aj = a->j,*ai = a->i,ii,*ailen = a->ilen; | |||
2377 | MatScalar *a_new,*mat_a; | |||
2378 | Mat C; | |||
2379 | PetscBool stride; | |||
2380 | ||||
2381 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2381; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2382 | ||||
2383 | ierr = ISGetIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2383,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2384 | ierr = ISGetLocalSize(isrow,&nrows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2384,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2385 | ierr = ISGetLocalSize(iscol,&ncols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2385,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2386 | ||||
2387 | ierr = PetscObjectTypeCompare((PetscObject)iscol,ISSTRIDE"stride",&stride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2387,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2388 | if (stride) { | |||
2389 | ierr = ISStrideGetInfo(iscol,&first,&step);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2390 | } else { | |||
2391 | first = 0; | |||
2392 | step = 0; | |||
2393 | } | |||
2394 | if (stride && step == 1) { | |||
2395 | /* special case of contiguous rows */ | |||
2396 | ierr = PetscMalloc2(nrows,&lens,nrows,&starts)PetscMallocA(2,PETSC_FALSE,2396,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nrows)*sizeof(**(&lens)),(&lens),(size_t)(nrows )*sizeof(**(&starts)),(&starts));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2396,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2397 | /* loop over new rows determining lens and starting points */ | |||
2398 | for (i=0; i<nrows; i++) { | |||
2399 | kstart = ai[irow[i]]; | |||
2400 | kend = kstart + ailen[irow[i]]; | |||
2401 | starts[i] = kstart; | |||
2402 | for (k=kstart; k<kend; k++) { | |||
2403 | if (aj[k] >= first) { | |||
2404 | starts[i] = k; | |||
2405 | break; | |||
2406 | } | |||
2407 | } | |||
2408 | sum = 0; | |||
2409 | while (k < kend) { | |||
2410 | if (aj[k++] >= first+ncols) break; | |||
2411 | sum++; | |||
2412 | } | |||
2413 | lens[i] = sum; | |||
2414 | } | |||
2415 | /* create submatrix */ | |||
2416 | if (scall == MAT_REUSE_MATRIX) { | |||
2417 | PetscInt n_cols,n_rows; | |||
2418 | ierr = MatGetSize(*B,&n_rows,&n_cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2418,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2419 | if (n_rows != nrows || n_cols != ncols) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Reused submatrix wrong size")return PetscError(((MPI_Comm)0x44000001),2419,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Reused submatrix wrong size"); | |||
2420 | ierr = MatZeroEntries(*B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2420,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2421 | C = *B; | |||
2422 | } else { | |||
2423 | PetscInt rbs,cbs; | |||
2424 | ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2424,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2425 | ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2425,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2426 | ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2426,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2427 | ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2427,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2428 | ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2428,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2429 | ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2429,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2430 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2430,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2431 | } | |||
2432 | c = (Mat_SeqAIJ*)C->data; | |||
2433 | ||||
2434 | /* loop over rows inserting into submatrix */ | |||
2435 | a_new = c->a; | |||
2436 | j_new = c->j; | |||
2437 | i_new = c->i; | |||
2438 | ||||
2439 | for (i=0; i<nrows; i++) { | |||
2440 | ii = starts[i]; | |||
2441 | lensi = lens[i]; | |||
2442 | for (k=0; k<lensi; k++) { | |||
2443 | *j_new++ = aj[ii+k] - first; | |||
2444 | } | |||
2445 | ierr = PetscArraycpy(a_new,a->a + starts[i],lensi)((sizeof(*(a_new)) != sizeof(*(a->a + starts[i]))) || PetscMemcpy (a_new,a->a + starts[i],(lensi)*sizeof(*(a_new))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2445,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2446 | a_new += lensi; | |||
2447 | i_new[i+1] = i_new[i] + lensi; | |||
2448 | c->ilen[i] = lensi; | |||
2449 | } | |||
2450 | ierr = PetscFree2(lens,starts)PetscFreeA(2,2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(lens),&(starts));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2451 | } else { | |||
2452 | ierr = ISGetIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2453 | ierr = PetscCalloc1(oldcols,&smap)PetscMallocA(1,PETSC_TRUE,2453,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(oldcols)*sizeof(**(&smap)),(&smap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2453,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2454 | ierr = PetscMalloc1(1+nrows,&lens)PetscMallocA(1,PETSC_FALSE,2454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(1+nrows)*sizeof(**(&lens)),(&lens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2455 | for (i=0; i<ncols; i++) { | |||
2456 | #if defined(PETSC_USE_DEBUG1) | |||
2457 | if (icol[i] >= oldcols) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Requesting column beyond largest column icol[%D] %D <= A->cmap->n %D",i,icol[i],oldcols)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),2457,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
2458 | #endif | |||
2459 | smap[icol[i]] = i+1; | |||
2460 | } | |||
2461 | ||||
2462 | /* determine lens of each row */ | |||
2463 | for (i=0; i<nrows; i++) { | |||
2464 | kstart = ai[irow[i]]; | |||
2465 | kend = kstart + a->ilen[irow[i]]; | |||
2466 | lens[i] = 0; | |||
2467 | for (k=kstart; k<kend; k++) { | |||
2468 | if (smap[aj[k]]) { | |||
2469 | lens[i]++; | |||
2470 | } | |||
2471 | } | |||
2472 | } | |||
2473 | /* Create and fill new matrix */ | |||
2474 | if (scall == MAT_REUSE_MATRIX) { | |||
2475 | PetscBool equal; | |||
2476 | ||||
2477 | c = (Mat_SeqAIJ*)((*B)->data); | |||
2478 | if ((*B)->rmap->n != nrows || (*B)->cmap->n != ncols) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Cannot reuse matrix. wrong size")return PetscError(((MPI_Comm)0x44000001),2478,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong size"); | |||
2479 | ierr = PetscArraycmp(c->ilen,lens,(*B)->rmap->n,&equal)((sizeof(*(c->ilen)) != sizeof(*(lens))) || PetscMemcmp(c-> ilen,lens,((*B)->rmap->n)*sizeof(*(c->ilen)),&equal ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2480 | if (!equal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Cannot reuse matrix. wrong no of nonzeros")return PetscError(((MPI_Comm)0x44000001),2480,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Cannot reuse matrix. wrong no of nonzeros" ); | |||
2481 | ierr = PetscArrayzero(c->ilen,(*B)->rmap->n)PetscMemzero(c->ilen,((*B)->rmap->n)*sizeof(*(c-> ilen)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2482 | C = *B; | |||
2483 | } else { | |||
2484 | PetscInt rbs,cbs; | |||
2485 | ierr = MatCreate(PetscObjectComm((PetscObject)A),&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2485,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2486 | ierr = MatSetSizes(C,nrows,ncols,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2487 | ierr = ISGetBlockSize(isrow,&rbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2488 | ierr = ISGetBlockSize(iscol,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2488,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2489 | ierr = MatSetBlockSizes(C,rbs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2490 | ierr = MatSetType(C,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2491 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(C,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2492 | } | |||
2493 | c = (Mat_SeqAIJ*)(C->data); | |||
2494 | for (i=0; i<nrows; i++) { | |||
2495 | row = irow[i]; | |||
2496 | kstart = ai[row]; | |||
2497 | kend = kstart + a->ilen[row]; | |||
2498 | mat_i = c->i[i]; | |||
2499 | mat_j = c->j + mat_i; | |||
2500 | mat_a = c->a + mat_i; | |||
2501 | mat_ilen = c->ilen + i; | |||
2502 | for (k=kstart; k<kend; k++) { | |||
2503 | if ((tcol=smap[a->j[k]])) { | |||
2504 | *mat_j++ = tcol - 1; | |||
2505 | *mat_a++ = a->a[k]; | |||
2506 | (*mat_ilen)++; | |||
2507 | ||||
2508 | } | |||
2509 | } | |||
2510 | } | |||
2511 | /* Free work space */ | |||
2512 | ierr = ISRestoreIndices(iscol,&icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2512,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2513 | ierr = PetscFree(smap)((*PetscTrFree)((void*)(smap),2513,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((smap) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2513,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2514 | ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2514,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((lens) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2514,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2515 | /* sort */ | |||
2516 | for (i = 0; i < nrows; i++) { | |||
2517 | PetscInt ilen; | |||
2518 | ||||
2519 | mat_i = c->i[i]; | |||
2520 | mat_j = c->j + mat_i; | |||
2521 | mat_a = c->a + mat_i; | |||
2522 | ilen = c->ilen[i]; | |||
2523 | ierr = PetscSortIntWithScalarArray(ilen,mat_j,mat_a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2523,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2524 | } | |||
2525 | } | |||
2526 | ierr = MatAssemblyBegin(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2526,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2527 | ierr = MatAssemblyEnd(C,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2527,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2528 | ||||
2529 | ierr = ISRestoreIndices(isrow,&irow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2529,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2530 | *B = C; | |||
2531 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2532 | } | |||
2533 | ||||
2534 | PetscErrorCode MatGetMultiProcBlock_SeqAIJ(Mat mat,MPI_Comm subComm,MatReuse scall,Mat *subMat) | |||
2535 | { | |||
2536 | PetscErrorCode ierr; | |||
2537 | Mat B; | |||
2538 | ||||
2539 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2539; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2540 | if (scall == MAT_INITIAL_MATRIX) { | |||
2541 | ierr = MatCreate(subComm,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2541,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2542 | ierr = MatSetSizes(B,mat->rmap->n,mat->cmap->n,mat->rmap->n,mat->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2542,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2543 | ierr = MatSetBlockSizesFromMats(B,mat,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2543,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2544 | ierr = MatSetType(B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2544,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2545 | ierr = MatDuplicateNoCreate_SeqAIJ(B,mat,MAT_COPY_VALUES,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2545,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2546 | *subMat = B; | |||
2547 | } else { | |||
2548 | ierr = MatCopy_SeqAIJ(mat,*subMat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2548,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2549 | } | |||
2550 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2551 | } | |||
2552 | ||||
2553 | PetscErrorCode MatILUFactor_SeqAIJ(Mat inA,IS row,IS col,const MatFactorInfo *info) | |||
2554 | { | |||
2555 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data; | |||
2556 | PetscErrorCode ierr; | |||
2557 | Mat outA; | |||
2558 | PetscBool row_identity,col_identity; | |||
2559 | ||||
2560 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2560; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2561 | if (info->levels != 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only levels=0 supported for in-place ilu")return PetscError(((MPI_Comm)0x44000001),2561,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"Only levels=0 supported for in-place ilu" ); | |||
2562 | ||||
2563 | ierr = ISIdentity(row,&row_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2563,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2564 | ierr = ISIdentity(col,&col_identity);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2564,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2565 | ||||
2566 | outA = inA; | |||
2567 | outA->factortype = MAT_FACTOR_LU; | |||
2568 | ierr = PetscFree(inA->solvertype)((*PetscTrFree)((void*)(inA->solvertype),2568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((inA->solvertype) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2569 | ierr = PetscStrallocpy(MATSOLVERPETSC"petsc",&inA->solvertype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2569,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2570 | ||||
2571 | ierr = PetscObjectReference((PetscObject)row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2571,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2572 | ierr = ISDestroy(&a->row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2573 | ||||
2574 | a->row = row; | |||
2575 | ||||
2576 | ierr = PetscObjectReference((PetscObject)col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2576,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2577 | ierr = ISDestroy(&a->col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2577,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2578 | ||||
2579 | a->col = col; | |||
2580 | ||||
2581 | /* Create the inverse permutation so that it can be used in MatLUFactorNumeric() */ | |||
2582 | ierr = ISDestroy(&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2582,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2583 | ierr = ISInvertPermutation(col,PETSC_DECIDE-1,&a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2583,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2584 | ierr = PetscLogObjectParent((PetscObject)inA,(PetscObject)a->icol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2584,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2585 | ||||
2586 | if (!a->solve_work) { /* this matrix may have been factored before */ | |||
2587 | ierr = PetscMalloc1(inA->rmap->n+1,&a->solve_work)PetscMallocA(1,PETSC_FALSE,2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(inA->rmap->n+1)*sizeof(**(&a->solve_work )),(&a->solve_work));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2588 | ierr = PetscLogObjectMemory((PetscObject)inA, (inA->rmap->n+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2588,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2589 | } | |||
2590 | ||||
2591 | ierr = MatMarkDiagonal_SeqAIJ(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2591,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2592 | if (row_identity && col_identity) { | |||
2593 | ierr = MatLUFactorNumeric_SeqAIJ_inplace(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2593,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2594 | } else { | |||
2595 | ierr = MatLUFactorNumeric_SeqAIJ_InplaceWithPerm(outA,inA,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2595,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2596 | } | |||
2597 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2598 | } | |||
2599 | ||||
2600 | PetscErrorCode MatScale_SeqAIJ(Mat inA,PetscScalar alpha) | |||
2601 | { | |||
2602 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)inA->data; | |||
2603 | PetscScalar oalpha = alpha; | |||
2604 | PetscErrorCode ierr; | |||
2605 | PetscBLASInt one = 1,bnz; | |||
2606 | ||||
2607 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2607; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2608 | ierr = PetscBLASIntCast(a->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2609 | PetscStackCallBLAS("BLASscal",BLASscal_(&bnz,&oalpha,a->a,&one))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "BLASscal"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2609; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); dscal_(&bnz,&oalpha,a->a,&one); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(2609,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm )0x44000001),2609,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),_7_ierr);}} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize --; petscstack->function[petscstack->currentsize] = 0; petscstack ->file[petscstack->currentsize] = 0; petscstack->line [petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
2610 | ierr = PetscLogFlops(a->nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2610,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2611 | ierr = MatSeqAIJInvalidateDiagonal(inA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2611,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2612 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2613 | } | |||
2614 | ||||
2615 | PetscErrorCode MatDestroySubMatrix_Private(Mat_SubSppt *submatj) | |||
2616 | { | |||
2617 | PetscErrorCode ierr; | |||
2618 | PetscInt i; | |||
2619 | ||||
2620 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2620; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2621 | if (!submatj->id) { /* delete data that are linked only to submats[id=0] */ | |||
2622 | ierr = PetscFree4(submatj->sbuf1,submatj->ptr,submatj->tmp,submatj->ctr)PetscFreeA(4,2622,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(submatj->sbuf1),&(submatj->ptr),&(submatj ->tmp),&(submatj->ctr));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2622,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2623 | ||||
2624 | for (i=0; i<submatj->nrqr; ++i) { | |||
2625 | ierr = PetscFree(submatj->sbuf2[i])((*PetscTrFree)((void*)(submatj->sbuf2[i]),2625,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->sbuf2[i]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2625,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2626 | } | |||
2627 | ierr = PetscFree3(submatj->sbuf2,submatj->req_size,submatj->req_source1)PetscFreeA(3,2627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(submatj->sbuf2),&(submatj->req_size),&(submatj ->req_source1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2628 | ||||
2629 | if (submatj->rbuf1) { | |||
2630 | ierr = PetscFree(submatj->rbuf1[0])((*PetscTrFree)((void*)(submatj->rbuf1[0]),2630,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->rbuf1[0]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2630,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2631 | ierr = PetscFree(submatj->rbuf1)((*PetscTrFree)((void*)(submatj->rbuf1),2631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->rbuf1) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2632 | } | |||
2633 | ||||
2634 | for (i=0; i<submatj->nrqs; ++i) { | |||
2635 | ierr = PetscFree(submatj->rbuf3[i])((*PetscTrFree)((void*)(submatj->rbuf3[i]),2635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->rbuf3[i]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2636 | } | |||
2637 | ierr = PetscFree3(submatj->req_source2,submatj->rbuf2,submatj->rbuf3)PetscFreeA(3,2637,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(submatj->req_source2),&(submatj->rbuf2),& (submatj->rbuf3));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2637,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2638 | ierr = PetscFree(submatj->pa)((*PetscTrFree)((void*)(submatj->pa),2638,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->pa) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2638,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2639 | } | |||
2640 | ||||
2641 | #if defined(PETSC_USE_CTABLE1) | |||
2642 | ierr = PetscTableDestroy((PetscTable*)&submatj->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2642,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2643 | if (submatj->cmap_loc) {ierr = PetscFree(submatj->cmap_loc)((*PetscTrFree)((void*)(submatj->cmap_loc),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->cmap_loc) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
2644 | ierr = PetscFree(submatj->rmap_loc)((*PetscTrFree)((void*)(submatj->rmap_loc),2644,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->rmap_loc) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2644,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2645 | #else | |||
2646 | ierr = PetscFree(submatj->rmap)((*PetscTrFree)((void*)(submatj->rmap),2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->rmap) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2647 | #endif | |||
2648 | ||||
2649 | if (!submatj->allcolumns) { | |||
2650 | #if defined(PETSC_USE_CTABLE1) | |||
2651 | ierr = PetscTableDestroy((PetscTable*)&submatj->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2651,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2652 | #else | |||
2653 | ierr = PetscFree(submatj->cmap)((*PetscTrFree)((void*)(submatj->cmap),2653,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->cmap) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2653,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2654 | #endif | |||
2655 | } | |||
2656 | ierr = PetscFree(submatj->row2proc)((*PetscTrFree)((void*)(submatj->row2proc),2656,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj->row2proc) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2656,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2657 | ||||
2658 | ierr = PetscFree(submatj)((*PetscTrFree)((void*)(submatj),2658,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((submatj) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2658,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2659 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2660 | } | |||
2661 | ||||
2662 | PetscErrorCode MatDestroySubMatrix_SeqAIJ(Mat C) | |||
2663 | { | |||
2664 | PetscErrorCode ierr; | |||
2665 | Mat_SeqAIJ *c = (Mat_SeqAIJ*)C->data; | |||
2666 | Mat_SubSppt *submatj = c->submatis1; | |||
2667 | ||||
2668 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2668; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2669 | ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2670 | ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2670,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2671 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2672 | } | |||
2673 | ||||
2674 | PetscErrorCode MatDestroySubMatrices_SeqAIJ(PetscInt n,Mat *mat[]) | |||
2675 | { | |||
2676 | PetscErrorCode ierr; | |||
2677 | PetscInt i; | |||
2678 | Mat C; | |||
2679 | Mat_SeqAIJ *c; | |||
2680 | Mat_SubSppt *submatj; | |||
2681 | ||||
2682 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2682; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2683 | for (i=0; i<n; i++) { | |||
2684 | C = (*mat)[i]; | |||
2685 | c = (Mat_SeqAIJ*)C->data; | |||
2686 | submatj = c->submatis1; | |||
2687 | if (submatj) { | |||
2688 | if (--((PetscObject)C)->refct <= 0) { | |||
2689 | ierr = (*submatj->destroy)(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2689,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2690 | ierr = MatDestroySubMatrix_Private(submatj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2691 | ierr = PetscFree(C->defaultvectype)((*PetscTrFree)((void*)(C->defaultvectype),2691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((C->defaultvectype) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2692 | ierr = PetscLayoutDestroy(&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2693 | ierr = PetscLayoutDestroy(&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2694 | ierr = PetscHeaderDestroy(&C)(PetscHeaderDestroy_Private((PetscObject)(*&C)) || ((*PetscTrFree )((void*)(*&C),2694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((*&C) = 0,0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2695 | } | |||
2696 | } else { | |||
2697 | ierr = MatDestroy(&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2698 | } | |||
2699 | } | |||
2700 | ||||
2701 | /* Destroy Dummy submatrices created for reuse */ | |||
2702 | ierr = MatDestroySubMatrices_Dummy(n,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2703 | ||||
2704 | ierr = PetscFree(*mat)((*PetscTrFree)((void*)(*mat),2704,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((*mat) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2704,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2705 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2706 | } | |||
2707 | ||||
2708 | PetscErrorCode MatCreateSubMatrices_SeqAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[]) | |||
2709 | { | |||
2710 | PetscErrorCode ierr; | |||
2711 | PetscInt i; | |||
2712 | ||||
2713 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2713; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2714 | if (scall == MAT_INITIAL_MATRIX) { | |||
2715 | ierr = PetscCalloc1(n+1,B)PetscMallocA(1,PETSC_TRUE,2715,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(n+1)*sizeof(**(B)),(B));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2715,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2716 | } | |||
2717 | ||||
2718 | for (i=0; i<n; i++) { | |||
2719 | ierr = MatCreateSubMatrix_SeqAIJ(A,irow[i],icol[i],PETSC_DECIDE-1,scall,&(*B)[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2720 | } | |||
2721 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2722 | } | |||
2723 | ||||
2724 | PetscErrorCode MatIncreaseOverlap_SeqAIJ(Mat A,PetscInt is_max,IS is[],PetscInt ov) | |||
2725 | { | |||
2726 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2727 | PetscErrorCode ierr; | |||
2728 | PetscInt row,i,j,k,l,m,n,*nidx,isz,val; | |||
2729 | const PetscInt *idx; | |||
2730 | PetscInt start,end,*ai,*aj; | |||
2731 | PetscBT table; | |||
2732 | ||||
2733 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2733; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2734 | m = A->rmap->n; | |||
2735 | ai = a->i; | |||
2736 | aj = a->j; | |||
2737 | ||||
2738 | if (ov < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"illegal negative overlap value used")return PetscError(((MPI_Comm)0x44000001),2738,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"illegal negative overlap value used" ); | |||
2739 | ||||
2740 | ierr = PetscMalloc1(m+1,&nidx)PetscMallocA(1,PETSC_FALSE,2740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m+1)*sizeof(**(&nidx)),(&nidx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2741 | ierr = PetscBTCreate(m,&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2741,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2742 | ||||
2743 | for (i=0; i<is_max; i++) { | |||
2744 | /* Initialize the two local arrays */ | |||
2745 | isz = 0; | |||
2746 | ierr = PetscBTMemzero(m,table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2747 | ||||
2748 | /* Extract the indices, assume there can be duplicate entries */ | |||
2749 | ierr = ISGetIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2749,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2750 | ierr = ISGetLocalSize(is[i],&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2750,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2751 | ||||
2752 | /* Enter these into the temp arrays. I.e., mark table[row], enter row into new index */ | |||
2753 | for (j=0; j<n; ++j) { | |||
2754 | if (!PetscBTLookupSet(table,idx[j])) nidx[isz++] = idx[j]; | |||
2755 | } | |||
2756 | ierr = ISRestoreIndices(is[i],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2756,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2757 | ierr = ISDestroy(&is[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2757,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2758 | ||||
2759 | k = 0; | |||
2760 | for (j=0; j<ov; j++) { /* for each overlap */ | |||
2761 | n = isz; | |||
2762 | for (; k<n; k++) { /* do only those rows in nidx[k], which are not done yet */ | |||
2763 | row = nidx[k]; | |||
2764 | start = ai[row]; | |||
2765 | end = ai[row+1]; | |||
2766 | for (l = start; l<end; l++) { | |||
2767 | val = aj[l]; | |||
2768 | if (!PetscBTLookupSet(table,val)) nidx[isz++] = val; | |||
2769 | } | |||
2770 | } | |||
2771 | } | |||
2772 | ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),isz,nidx,PETSC_COPY_VALUES,(is+i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2773 | } | |||
2774 | ierr = PetscBTDestroy(&table);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2774,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2775 | ierr = PetscFree(nidx)((*PetscTrFree)((void*)(nidx),2775,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((nidx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2775,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2776 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2777 | } | |||
2778 | ||||
2779 | /* -------------------------------------------------------------- */ | |||
2780 | PetscErrorCode MatPermute_SeqAIJ(Mat A,IS rowp,IS colp,Mat *B) | |||
2781 | { | |||
2782 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2783 | PetscErrorCode ierr; | |||
2784 | PetscInt i,nz = 0,m = A->rmap->n,n = A->cmap->n; | |||
2785 | const PetscInt *row,*col; | |||
2786 | PetscInt *cnew,j,*lens; | |||
2787 | IS icolp,irowp; | |||
2788 | PetscInt *cwork = NULL((void*)0); | |||
2789 | PetscScalar *vwork = NULL((void*)0); | |||
2790 | ||||
2791 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2791; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2792 | ierr = ISInvertPermutation(rowp,PETSC_DECIDE-1,&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2793 | ierr = ISGetIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2793,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2794 | ierr = ISInvertPermutation(colp,PETSC_DECIDE-1,&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2795 | ierr = ISGetIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2796 | ||||
2797 | /* determine lengths of permuted rows */ | |||
2798 | ierr = PetscMalloc1(m+1,&lens)PetscMallocA(1,PETSC_FALSE,2798,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m+1)*sizeof(**(&lens)),(&lens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2798,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2799 | for (i=0; i<m; i++) lens[row[i]] = a->i[i+1] - a->i[i]; | |||
2800 | ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2800,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2801 | ierr = MatSetSizes(*B,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2801,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2802 | ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2803 | ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2804 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(*B,0,lens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2805 | ierr = PetscFree(lens)((*PetscTrFree)((void*)(lens),2805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((lens) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2806 | ||||
2807 | ierr = PetscMalloc1(n,&cnew)PetscMallocA(1,PETSC_FALSE,2807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(n)*sizeof(**(&cnew)),(&cnew));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2808 | for (i=0; i<m; i++) { | |||
2809 | ierr = MatGetRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2809,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2810 | for (j=0; j<nz; j++) cnew[j] = col[cwork[j]]; | |||
2811 | ierr = MatSetValues_SeqAIJ(*B,1,&row[i],nz,cnew,vwork,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2812 | ierr = MatRestoreRow_SeqAIJ(A,i,&nz,&cwork,&vwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2812,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2813 | } | |||
2814 | ierr = PetscFree(cnew)((*PetscTrFree)((void*)(cnew),2814,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((cnew) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2814,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2815 | ||||
2816 | (*B)->assembled = PETSC_FALSE; | |||
2817 | ||||
2818 | ierr = MatAssemblyBegin(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2818,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2819 | ierr = MatAssemblyEnd(*B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2819,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2820 | ierr = ISRestoreIndices(irowp,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2820,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2821 | ierr = ISRestoreIndices(icolp,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2821,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2822 | ierr = ISDestroy(&irowp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2822,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2823 | ierr = ISDestroy(&icolp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2823,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2824 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2825 | } | |||
2826 | ||||
2827 | PetscErrorCode MatCopy_SeqAIJ(Mat A,Mat B,MatStructure str) | |||
2828 | { | |||
2829 | PetscErrorCode ierr; | |||
2830 | ||||
2831 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2831; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2832 | /* If the two matrices have the same copy implementation, use fast copy. */ | |||
2833 | if (str == SAME_NONZERO_PATTERN && (A->ops->copy == B->ops->copy)) { | |||
2834 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2835 | Mat_SeqAIJ *b = (Mat_SeqAIJ*)B->data; | |||
2836 | ||||
2837 | if (a->i[A->rmap->n] != b->i[B->rmap->n]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Number of nonzeros in two matrices are different")return PetscError(((MPI_Comm)0x44000001),2837,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,75,PETSC_ERROR_INITIAL,"Number of nonzeros in two matrices are different" ); | |||
2838 | ierr = PetscArraycpy(b->a,a->a,a->i[A->rmap->n])((sizeof(*(b->a)) != sizeof(*(a->a))) || PetscMemcpy(b-> a,a->a,(a->i[A->rmap->n])*sizeof(*(b->a))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2839 | ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2840 | } else { | |||
2841 | ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2841,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2842 | } | |||
2843 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2844 | } | |||
2845 | ||||
2846 | PetscErrorCode MatSetUp_SeqAIJ(Mat A) | |||
2847 | { | |||
2848 | PetscErrorCode ierr; | |||
2849 | ||||
2850 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2850; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2851 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(A,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2852 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2853 | } | |||
2854 | ||||
2855 | PetscErrorCode MatSeqAIJGetArray_SeqAIJ(Mat A,PetscScalar *array[]) | |||
2856 | { | |||
2857 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2858 | ||||
2859 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2859; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2860 | *array = a->a; | |||
2861 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2862 | } | |||
2863 | ||||
2864 | PetscErrorCode MatSeqAIJRestoreArray_SeqAIJ(Mat A,PetscScalar *array[]) | |||
2865 | { | |||
2866 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2866; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2867 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2868 | } | |||
2869 | ||||
2870 | /* | |||
2871 | Computes the number of nonzeros per row needed for preallocation when X and Y | |||
2872 | have different nonzero structure. | |||
2873 | */ | |||
2874 | PetscErrorCode MatAXPYGetPreallocation_SeqX_private(PetscInt m,const PetscInt *xi,const PetscInt *xj,const PetscInt *yi,const PetscInt *yj,PetscInt *nnz) | |||
2875 | { | |||
2876 | PetscInt i,j,k,nzx,nzy; | |||
2877 | ||||
2878 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2878; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2879 | /* Set the number of nonzeros in the new matrix */ | |||
2880 | for (i=0; i<m; i++) { | |||
2881 | const PetscInt *xjj = xj+xi[i],*yjj = yj+yi[i]; | |||
2882 | nzx = xi[i+1] - xi[i]; | |||
2883 | nzy = yi[i+1] - yi[i]; | |||
2884 | nnz[i] = 0; | |||
2885 | for (j=0,k=0; j<nzx; j++) { /* Point in X */ | |||
2886 | for (; k<nzy && yjj[k]<xjj[j]; k++) nnz[i]++; /* Catch up to X */ | |||
2887 | if (k<nzy && yjj[k]==xjj[j]) k++; /* Skip duplicate */ | |||
2888 | nnz[i]++; | |||
2889 | } | |||
2890 | for (; k<nzy; k++) nnz[i]++; | |||
2891 | } | |||
2892 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2893 | } | |||
2894 | ||||
2895 | PetscErrorCode MatAXPYGetPreallocation_SeqAIJ(Mat Y,Mat X,PetscInt *nnz) | |||
2896 | { | |||
2897 | PetscInt m = Y->rmap->N; | |||
2898 | Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data; | |||
2899 | Mat_SeqAIJ *y = (Mat_SeqAIJ*)Y->data; | |||
2900 | PetscErrorCode ierr; | |||
2901 | ||||
2902 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2902; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2903 | /* Set the number of nonzeros in the new matrix */ | |||
2904 | ierr = MatAXPYGetPreallocation_SeqX_private(m,x->i,x->j,y->i,y->j,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2904,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2905 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2906 | } | |||
2907 | ||||
2908 | PetscErrorCode MatAXPY_SeqAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str) | |||
2909 | { | |||
2910 | PetscErrorCode ierr; | |||
2911 | Mat_SeqAIJ *x = (Mat_SeqAIJ*)X->data,*y = (Mat_SeqAIJ*)Y->data; | |||
2912 | PetscBLASInt one=1,bnz; | |||
2913 | ||||
2914 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2914; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2915 | ierr = PetscBLASIntCast(x->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2916 | if (str == SAME_NONZERO_PATTERN) { | |||
2917 | PetscScalar alpha = a; | |||
2918 | PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,x->a,&one,y->a,&one))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "BLASaxpy"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2918; 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(2918 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) {PetscError(((MPI_Comm )0x44000001),2918,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),_7_ierr);}} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize --; petscstack->function[petscstack->currentsize] = 0; petscstack ->file[petscstack->currentsize] = 0; petscstack->line [petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
2919 | ierr = MatSeqAIJInvalidateDiagonal(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2920 | ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2920,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2921 | } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */ | |||
2922 | ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2922,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2923 | } else { | |||
2924 | Mat B; | |||
2925 | PetscInt *nnz; | |||
2926 | ierr = PetscMalloc1(Y->rmap->N,&nnz)PetscMallocA(1,PETSC_FALSE,2926,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(Y->rmap->N)*sizeof(**(&nnz)),(&nnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2926,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2927 | ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2927,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2928 | ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2928,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2929 | ierr = MatSetSizes(B,Y->rmap->n,Y->cmap->n,Y->rmap->N,Y->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2929,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2930 | ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2930,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2931 | ierr = MatSetType(B,(MatType) ((PetscObject)Y)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2932 | ierr = MatAXPYGetPreallocation_SeqAIJ(Y,X,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2932,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2933 | ierr = MatSeqAIJSetPreallocation(B,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2934 | ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2934,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2935 | ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2936 | ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((nnz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2937 | } | |||
2938 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2939 | } | |||
2940 | ||||
2941 | PetscErrorCode MatConjugate_SeqAIJ(Mat mat) | |||
2942 | { | |||
2943 | #if defined(PETSC_USE_COMPLEX) | |||
2944 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data; | |||
2945 | PetscInt i,nz; | |||
2946 | PetscScalar *a; | |||
2947 | ||||
2948 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2948; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2949 | nz = aij->nz; | |||
2950 | a = aij->a; | |||
2951 | for (i=0; i<nz; i++) a[i] = PetscConj(a[i])(a[i]); | |||
2952 | #else | |||
2953 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2953; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2954 | #endif | |||
2955 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2956 | } | |||
2957 | ||||
2958 | PetscErrorCode MatGetRowMaxAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[]) | |||
2959 | { | |||
2960 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2961 | PetscErrorCode ierr; | |||
2962 | PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n; | |||
2963 | PetscReal atmp; | |||
2964 | PetscScalar *x; | |||
2965 | MatScalar *aa; | |||
2966 | ||||
2967 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2967; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2968 | if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),2968,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
2969 | aa = a->a; | |||
2970 | ai = a->i; | |||
2971 | aj = a->j; | |||
2972 | ||||
2973 | ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2974 | ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2974,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2975 | ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2975,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2976 | if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),2976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector"); | |||
2977 | for (i=0; i<m; i++) { | |||
2978 | ncols = ai[1] - ai[0]; ai++; | |||
2979 | x[i] = 0.0; | |||
2980 | for (j=0; j<ncols; j++) { | |||
2981 | atmp = PetscAbsScalar(*aa); | |||
2982 | if (PetscAbsScalar(x[i]) < atmp) {x[i] = atmp; if (idx) idx[i] = *aj;} | |||
2983 | aa++; aj++; | |||
2984 | } | |||
2985 | } | |||
2986 | ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),2986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
2987 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2988 | } | |||
2989 | ||||
2990 | PetscErrorCode MatGetRowMax_SeqAIJ(Mat A,Vec v,PetscInt idx[]) | |||
2991 | { | |||
2992 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
2993 | PetscErrorCode ierr; | |||
2994 | PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n; | |||
2995 | PetscScalar *x; | |||
2996 | MatScalar *aa; | |||
2997 | ||||
2998 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 2998; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2999 | if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),2999,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
3000 | aa = a->a; | |||
3001 | ai = a->i; | |||
3002 | aj = a->j; | |||
3003 | ||||
3004 | ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3004,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3005 | ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3005,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3006 | ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3006,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3007 | if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3007,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector"); | |||
3008 | for (i=0; i<m; i++) { | |||
3009 | ncols = ai[1] - ai[0]; ai++; | |||
3010 | if (ncols == A->cmap->n) { /* row is dense */ | |||
3011 | x[i] = *aa; if (idx) idx[i] = 0; | |||
3012 | } else { /* row is sparse so already KNOW maximum is 0.0 or higher */ | |||
3013 | x[i] = 0.0; | |||
3014 | if (idx) { | |||
3015 | idx[i] = 0; /* in case ncols is zero */ | |||
3016 | for (j=0;j<ncols;j++) { /* find first implicit 0.0 in the row */ | |||
3017 | if (aj[j] > j) { | |||
3018 | idx[i] = j; | |||
3019 | break; | |||
3020 | } | |||
3021 | } | |||
3022 | } | |||
3023 | } | |||
3024 | for (j=0; j<ncols; j++) { | |||
3025 | if (PetscRealPart(x[i])(x[i]) < PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;} | |||
3026 | aa++; aj++; | |||
3027 | } | |||
3028 | } | |||
3029 | ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3029,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3030 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3031 | } | |||
3032 | ||||
3033 | PetscErrorCode MatGetRowMinAbs_SeqAIJ(Mat A,Vec v,PetscInt idx[]) | |||
3034 | { | |||
3035 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
3036 | PetscErrorCode ierr; | |||
3037 | PetscInt i,j,m = A->rmap->n,*ai,*aj,ncols,n; | |||
3038 | PetscReal atmp; | |||
3039 | PetscScalar *x; | |||
3040 | MatScalar *aa; | |||
3041 | ||||
3042 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3042; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3043 | if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3043,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
3044 | aa = a->a; | |||
3045 | ai = a->i; | |||
3046 | aj = a->j; | |||
3047 | ||||
3048 | ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3049 | ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3050 | ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3051 | if (n != A->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector, %D vs. %D rows", A->rmap->n, n)do {if (__builtin_expect(!!(60),0)) {PetscError(((MPI_Comm)0x44000001 ),3051,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 60);}} while (0); | |||
3052 | for (i=0; i<m; i++) { | |||
3053 | ncols = ai[1] - ai[0]; ai++; | |||
3054 | if (ncols) { | |||
3055 | /* Get first nonzero */ | |||
3056 | for (j = 0; j < ncols; j++) { | |||
3057 | atmp = PetscAbsScalar(aa[j]); | |||
3058 | if (atmp > 1.0e-12) { | |||
3059 | x[i] = atmp; | |||
3060 | if (idx) idx[i] = aj[j]; | |||
3061 | break; | |||
3062 | } | |||
3063 | } | |||
3064 | if (j == ncols) {x[i] = PetscAbsScalar(*aa); if (idx) idx[i] = *aj;} | |||
3065 | } else { | |||
3066 | x[i] = 0.0; if (idx) idx[i] = 0; | |||
3067 | } | |||
3068 | for (j = 0; j < ncols; j++) { | |||
3069 | atmp = PetscAbsScalar(*aa); | |||
3070 | if (atmp > 1.0e-12 && PetscAbsScalar(x[i]) > atmp) {x[i] = atmp; if (idx) idx[i] = *aj;} | |||
3071 | aa++; aj++; | |||
3072 | } | |||
3073 | } | |||
3074 | ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3074,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3075 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3076 | } | |||
3077 | ||||
3078 | PetscErrorCode MatGetRowMin_SeqAIJ(Mat A,Vec v,PetscInt idx[]) | |||
3079 | { | |||
3080 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
3081 | PetscErrorCode ierr; | |||
3082 | PetscInt i,j,m = A->rmap->n,ncols,n; | |||
3083 | const PetscInt *ai,*aj; | |||
3084 | PetscScalar *x; | |||
3085 | const MatScalar *aa; | |||
3086 | ||||
3087 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3087; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3088 | if (A->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3088,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
3089 | aa = a->a; | |||
3090 | ai = a->i; | |||
3091 | aj = a->j; | |||
3092 | ||||
3093 | ierr = VecSet(v,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3093,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3094 | ierr = VecGetArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3094,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3095 | ierr = VecGetLocalSize(v,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3095,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3096 | if (n != A->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Nonconforming matrix and vector")return PetscError(((MPI_Comm)0x44000001),3096,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"Nonconforming matrix and vector"); | |||
3097 | for (i=0; i<m; i++) { | |||
3098 | ncols = ai[1] - ai[0]; ai++; | |||
3099 | if (ncols == A->cmap->n) { /* row is dense */ | |||
3100 | x[i] = *aa; if (idx) idx[i] = 0; | |||
3101 | } else { /* row is sparse so already KNOW minimum is 0.0 or lower */ | |||
3102 | x[i] = 0.0; | |||
3103 | if (idx) { /* find first implicit 0.0 in the row */ | |||
3104 | idx[i] = 0; /* in case ncols is zero */ | |||
3105 | for (j=0; j<ncols; j++) { | |||
3106 | if (aj[j] > j) { | |||
3107 | idx[i] = j; | |||
3108 | break; | |||
3109 | } | |||
3110 | } | |||
3111 | } | |||
3112 | } | |||
3113 | for (j=0; j<ncols; j++) { | |||
3114 | if (PetscRealPart(x[i])(x[i]) > PetscRealPart(*aa)(*aa)) {x[i] = *aa; if (idx) idx[i] = *aj;} | |||
3115 | aa++; aj++; | |||
3116 | } | |||
3117 | } | |||
3118 | ierr = VecRestoreArray(v,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3118,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3119 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3120 | } | |||
3121 | ||||
3122 | PetscErrorCode MatInvertBlockDiagonal_SeqAIJ(Mat A,const PetscScalar **values) | |||
3123 | { | |||
3124 | Mat_SeqAIJ *a = (Mat_SeqAIJ*) A->data; | |||
3125 | PetscErrorCode ierr; | |||
3126 | PetscInt i,bs = PetscAbs(A->rmap->bs)(((A->rmap->bs) >= 0) ? (A->rmap->bs) : (-(A-> rmap->bs))),mbs = A->rmap->n/bs,ipvt[5],bs2 = bs*bs,*v_pivots,ij[7],*IJ,j; | |||
3127 | MatScalar *diag,work[25],*v_work; | |||
3128 | const PetscReal shift = 0.0; | |||
3129 | PetscBool allowzeropivot,zeropivotdetected=PETSC_FALSE; | |||
3130 | ||||
3131 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3131; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3132 | allowzeropivot = PetscNot(A->erroriffailure)((A->erroriffailure) ? PETSC_FALSE : PETSC_TRUE); | |||
3133 | if (a->ibdiagvalid) { | |||
3134 | if (values) *values = a->ibdiag; | |||
3135 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3136 | } | |||
3137 | ierr = MatMarkDiagonal_SeqAIJ(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3137,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3138 | if (!a->ibdiag) { | |||
3139 | ierr = PetscMalloc1(bs2*mbs,&a->ibdiag)PetscMallocA(1,PETSC_FALSE,3139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(bs2*mbs)*sizeof(**(&a->ibdiag)),(&a-> ibdiag));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3140 | ierr = PetscLogObjectMemory((PetscObject)A,bs2*mbs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3140,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3141 | } | |||
3142 | diag = a->ibdiag; | |||
3143 | if (values) *values = a->ibdiag; | |||
3144 | /* factor and invert each block */ | |||
3145 | switch (bs) { | |||
3146 | case 1: | |||
3147 | for (i=0; i<mbs; i++) { | |||
3148 | ierr = MatGetValues(A,1,&i,1,&i,diag+i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3149 | if (PetscAbsScalar(diag[i] + shift) < PETSC_MACHINE_EPSILON2.2204460492503131e-16) { | |||
3150 | if (allowzeropivot) { | |||
3151 | A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3152 | A->factorerror_zeropivot_value = PetscAbsScalar(diag[i]); | |||
3153 | A->factorerror_zeropivot_row = i; | |||
3154 | ierr = PetscInfo3(A,"Zero pivot, row %D pivot %g tolerance %g\n",i,(double)PetscAbsScalar(diag[i]),(double)PETSC_MACHINE_EPSILON)PetscInfo_Private(__func__,A,"Zero pivot, row %D pivot %g tolerance %g\n" ,i,(double)PetscAbsScalar(diag[i]),(double)2.2204460492503131e-16 );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3154,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3155 | } else SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_MAT_LU_ZRPVT,"Zero pivot, row %D pivot %g tolerance %g",i,(double)PetscAbsScalar(diag[i]),(double)PETSC_MACHINE_EPSILON)do {if (__builtin_expect(!!(71),0)) {PetscError(((MPI_Comm)0x44000001 ),3155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,71,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 71);}} while (0); | |||
3156 | } | |||
3157 | diag[i] = (PetscScalar)1.0 / (diag[i] + shift); | |||
3158 | } | |||
3159 | break; | |||
3160 | case 2: | |||
3161 | for (i=0; i<mbs; i++) { | |||
3162 | ij[0] = 2*i; ij[1] = 2*i + 1; | |||
3163 | ierr = MatGetValues(A,2,ij,2,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3164 | ierr = PetscKernel_A_gets_inverse_A_2(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3165 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3166 | ierr = PetscKernel_A_gets_transpose_A_2(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3166,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3167 | diag += 4; | |||
3168 | } | |||
3169 | break; | |||
3170 | case 3: | |||
3171 | for (i=0; i<mbs; i++) { | |||
3172 | ij[0] = 3*i; ij[1] = 3*i + 1; ij[2] = 3*i + 2; | |||
3173 | ierr = MatGetValues(A,3,ij,3,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3173,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3174 | ierr = PetscKernel_A_gets_inverse_A_3(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3174,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3175 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3176 | ierr = PetscKernel_A_gets_transpose_A_3(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3177 | diag += 9; | |||
3178 | } | |||
3179 | break; | |||
3180 | case 4: | |||
3181 | for (i=0; i<mbs; i++) { | |||
3182 | ij[0] = 4*i; ij[1] = 4*i + 1; ij[2] = 4*i + 2; ij[3] = 4*i + 3; | |||
3183 | ierr = MatGetValues(A,4,ij,4,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3184 | ierr = PetscKernel_A_gets_inverse_A_4(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3184,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3185 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3186 | ierr = PetscKernel_A_gets_transpose_A_4(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3186,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3187 | diag += 16; | |||
3188 | } | |||
3189 | break; | |||
3190 | case 5: | |||
3191 | for (i=0; i<mbs; i++) { | |||
3192 | ij[0] = 5*i; ij[1] = 5*i + 1; ij[2] = 5*i + 2; ij[3] = 5*i + 3; ij[4] = 5*i + 4; | |||
3193 | ierr = MatGetValues(A,5,ij,5,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3194 | ierr = PetscKernel_A_gets_inverse_A_5(diag,ipvt,work,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3194,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3195 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3196 | ierr = PetscKernel_A_gets_transpose_A_5(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3197 | diag += 25; | |||
3198 | } | |||
3199 | break; | |||
3200 | case 6: | |||
3201 | for (i=0; i<mbs; i++) { | |||
3202 | ij[0] = 6*i; ij[1] = 6*i + 1; ij[2] = 6*i + 2; ij[3] = 6*i + 3; ij[4] = 6*i + 4; ij[5] = 6*i + 5; | |||
3203 | ierr = MatGetValues(A,6,ij,6,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3204 | ierr = PetscKernel_A_gets_inverse_A_6(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3205 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3206 | ierr = PetscKernel_A_gets_transpose_A_6(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3207 | diag += 36; | |||
3208 | } | |||
3209 | break; | |||
3210 | case 7: | |||
3211 | for (i=0; i<mbs; i++) { | |||
3212 | ij[0] = 7*i; ij[1] = 7*i + 1; ij[2] = 7*i + 2; ij[3] = 7*i + 3; ij[4] = 7*i + 4; ij[5] = 7*i + 5; ij[5] = 7*i + 6; | |||
3213 | ierr = MatGetValues(A,7,ij,7,ij,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3214 | ierr = PetscKernel_A_gets_inverse_A_7(diag,shift,allowzeropivot,&zeropivotdetected);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3214,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3215 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3216 | ierr = PetscKernel_A_gets_transpose_A_7(diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3217 | diag += 49; | |||
3218 | } | |||
3219 | break; | |||
3220 | default: | |||
3221 | ierr = PetscMalloc3(bs,&v_work,bs,&v_pivots,bs,&IJ)PetscMallocA(3,PETSC_FALSE,3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(bs)*sizeof(**(&v_work)),(&v_work),(size_t)( bs)*sizeof(**(&v_pivots)),(&v_pivots),(size_t)(bs)*sizeof (**(&IJ)),(&IJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3222 | for (i=0; i<mbs; i++) { | |||
3223 | for (j=0; j<bs; j++) { | |||
3224 | IJ[j] = bs*i + j; | |||
3225 | } | |||
3226 | ierr = MatGetValues(A,bs,IJ,bs,IJ,diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3227 | ierr = PetscKernel_A_gets_inverse_A(bs,diag,v_pivots,v_work,allowzeropivot,&zeropivotdetected)(PetscLINPACKgefa((diag),(bs),(v_pivots),(allowzeropivot),(& zeropivotdetected)) || PetscLINPACKgedi((diag),(bs),(v_pivots ),(v_work)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3227,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3228 | if (zeropivotdetected) A->factorerrortype = MAT_FACTOR_NUMERIC_ZEROPIVOT; | |||
3229 | ierr = PetscKernel_A_gets_transpose_A_N(diag,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3230 | diag += bs2; | |||
3231 | } | |||
3232 | ierr = PetscFree3(v_work,v_pivots,IJ)PetscFreeA(3,3232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,&(v_work),&(v_pivots),&(IJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3233 | } | |||
3234 | a->ibdiagvalid = PETSC_TRUE; | |||
3235 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3236 | } | |||
3237 | ||||
3238 | static PetscErrorCode MatSetRandom_SeqAIJ(Mat x,PetscRandom rctx) | |||
3239 | { | |||
3240 | PetscErrorCode ierr; | |||
3241 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data; | |||
3242 | PetscScalar a; | |||
3243 | PetscInt m,n,i,j,col; | |||
3244 | ||||
3245 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3245; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3246 | if (!x->assembled) { | |||
3247 | ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3248 | for (i=0; i<m; i++) { | |||
3249 | for (j=0; j<aij->imax[i]; j++) { | |||
3250 | ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3250,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3251 | col = (PetscInt)(n*PetscRealPart(a)(a)); | |||
3252 | ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3252,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3253 | } | |||
3254 | } | |||
3255 | } else { | |||
3256 | for (i=0; i<aij->nz; i++) {ierr = PetscRandomGetValue(rctx,aij->a+i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0);} | |||
3257 | } | |||
3258 | ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3259 | ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3259,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3260 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3261 | } | |||
3262 | ||||
3263 | /* Like MatSetRandom_SeqAIJ, but do not set values on columns in range of [low, high) */ | |||
3264 | PetscErrorCode MatSetRandomSkipColumnRange_SeqAIJ_Private(Mat x,PetscInt low,PetscInt high,PetscRandom rctx) | |||
3265 | { | |||
3266 | PetscErrorCode ierr; | |||
3267 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)x->data; | |||
3268 | PetscScalar a; | |||
3269 | PetscInt m,n,i,j,col,nskip; | |||
3270 | ||||
3271 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3271; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3272 | nskip = high - low; | |||
3273 | ierr = MatGetSize(x,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3274 | n -= nskip; /* shrink number of columns where nonzeros can be set */ | |||
3275 | for (i=0; i<m; i++) { | |||
3276 | for (j=0; j<aij->imax[i]; j++) { | |||
3277 | ierr = PetscRandomGetValue(rctx,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3278 | col = (PetscInt)(n*PetscRealPart(a)(a)); | |||
3279 | if (col >= low) col += nskip; /* shift col rightward to skip the hole */ | |||
3280 | ierr = MatSetValues(x,1,&i,1,&col,&a,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3280,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3281 | } | |||
3282 | } | |||
3283 | ierr = MatAssemblyBegin(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3283,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3284 | ierr = MatAssemblyEnd(x,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3284,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3285 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3286 | } | |||
3287 | ||||
3288 | ||||
3289 | /* -------------------------------------------------------------------*/ | |||
3290 | static struct _MatOps MatOps_Values = { MatSetValues_SeqAIJ, | |||
3291 | MatGetRow_SeqAIJ, | |||
3292 | MatRestoreRow_SeqAIJ, | |||
3293 | MatMult_SeqAIJ, | |||
3294 | /* 4*/ MatMultAdd_SeqAIJ, | |||
3295 | MatMultTranspose_SeqAIJ, | |||
3296 | MatMultTransposeAdd_SeqAIJ, | |||
3297 | 0, | |||
3298 | 0, | |||
3299 | 0, | |||
3300 | /* 10*/ 0, | |||
3301 | MatLUFactor_SeqAIJ, | |||
3302 | 0, | |||
3303 | MatSOR_SeqAIJ, | |||
3304 | MatTranspose_SeqAIJ, | |||
3305 | /*1 5*/ MatGetInfo_SeqAIJ, | |||
3306 | MatEqual_SeqAIJ, | |||
3307 | MatGetDiagonal_SeqAIJ, | |||
3308 | MatDiagonalScale_SeqAIJ, | |||
3309 | MatNorm_SeqAIJ, | |||
3310 | /* 20*/ 0, | |||
3311 | MatAssemblyEnd_SeqAIJ, | |||
3312 | MatSetOption_SeqAIJ, | |||
3313 | MatZeroEntries_SeqAIJ, | |||
3314 | /* 24*/ MatZeroRows_SeqAIJ, | |||
3315 | 0, | |||
3316 | 0, | |||
3317 | 0, | |||
3318 | 0, | |||
3319 | /* 29*/ MatSetUp_SeqAIJ, | |||
3320 | 0, | |||
3321 | 0, | |||
3322 | 0, | |||
3323 | 0, | |||
3324 | /* 34*/ MatDuplicate_SeqAIJ, | |||
3325 | 0, | |||
3326 | 0, | |||
3327 | MatILUFactor_SeqAIJ, | |||
3328 | 0, | |||
3329 | /* 39*/ MatAXPY_SeqAIJ, | |||
3330 | MatCreateSubMatrices_SeqAIJ, | |||
3331 | MatIncreaseOverlap_SeqAIJ, | |||
3332 | MatGetValues_SeqAIJ, | |||
3333 | MatCopy_SeqAIJ, | |||
3334 | /* 44*/ MatGetRowMax_SeqAIJ, | |||
3335 | MatScale_SeqAIJ, | |||
3336 | MatShift_SeqAIJ, | |||
3337 | MatDiagonalSet_SeqAIJ, | |||
3338 | MatZeroRowsColumns_SeqAIJ, | |||
3339 | /* 49*/ MatSetRandom_SeqAIJ, | |||
3340 | MatGetRowIJ_SeqAIJ, | |||
3341 | MatRestoreRowIJ_SeqAIJ, | |||
3342 | MatGetColumnIJ_SeqAIJ, | |||
3343 | MatRestoreColumnIJ_SeqAIJ, | |||
3344 | /* 54*/ MatFDColoringCreate_SeqXAIJ, | |||
3345 | 0, | |||
3346 | 0, | |||
3347 | MatPermute_SeqAIJ, | |||
3348 | 0, | |||
3349 | /* 59*/ 0, | |||
3350 | MatDestroy_SeqAIJ, | |||
3351 | MatView_SeqAIJ, | |||
3352 | 0, | |||
3353 | MatMatMatMult_SeqAIJ_SeqAIJ_SeqAIJ, | |||
3354 | /* 64*/ MatMatMatMultSymbolic_SeqAIJ_SeqAIJ_SeqAIJ, | |||
3355 | MatMatMatMultNumeric_SeqAIJ_SeqAIJ_SeqAIJ, | |||
3356 | 0, | |||
3357 | 0, | |||
3358 | 0, | |||
3359 | /* 69*/ MatGetRowMaxAbs_SeqAIJ, | |||
3360 | MatGetRowMinAbs_SeqAIJ, | |||
3361 | 0, | |||
3362 | 0, | |||
3363 | 0, | |||
3364 | /* 74*/ 0, | |||
3365 | MatFDColoringApply_AIJ, | |||
3366 | 0, | |||
3367 | 0, | |||
3368 | 0, | |||
3369 | /* 79*/ MatFindZeroDiagonals_SeqAIJ, | |||
3370 | 0, | |||
3371 | 0, | |||
3372 | 0, | |||
3373 | MatLoad_SeqAIJ, | |||
3374 | /* 84*/ MatIsSymmetric_SeqAIJ, | |||
3375 | MatIsHermitian_SeqAIJ, | |||
3376 | 0, | |||
3377 | 0, | |||
3378 | 0, | |||
3379 | /* 89*/ MatMatMult_SeqAIJ_SeqAIJ, | |||
3380 | MatMatMultSymbolic_SeqAIJ_SeqAIJ, | |||
3381 | MatMatMultNumeric_SeqAIJ_SeqAIJ, | |||
3382 | MatPtAP_SeqAIJ_SeqAIJ, | |||
3383 | MatPtAPSymbolic_SeqAIJ_SeqAIJ_SparseAxpy, | |||
3384 | /* 94*/ MatPtAPNumeric_SeqAIJ_SeqAIJ_SparseAxpy, | |||
3385 | MatMatTransposeMult_SeqAIJ_SeqAIJ, | |||
3386 | MatMatTransposeMultSymbolic_SeqAIJ_SeqAIJ, | |||
3387 | MatMatTransposeMultNumeric_SeqAIJ_SeqAIJ, | |||
3388 | 0, | |||
3389 | /* 99*/ 0, | |||
3390 | 0, | |||
3391 | 0, | |||
3392 | MatConjugate_SeqAIJ, | |||
3393 | 0, | |||
3394 | /*104*/ MatSetValuesRow_SeqAIJ, | |||
3395 | MatRealPart_SeqAIJ, | |||
3396 | MatImaginaryPart_SeqAIJ, | |||
3397 | 0, | |||
3398 | 0, | |||
3399 | /*109*/ MatMatSolve_SeqAIJ, | |||
3400 | 0, | |||
3401 | MatGetRowMin_SeqAIJ, | |||
3402 | 0, | |||
3403 | MatMissingDiagonal_SeqAIJ, | |||
3404 | /*114*/ 0, | |||
3405 | 0, | |||
3406 | 0, | |||
3407 | 0, | |||
3408 | 0, | |||
3409 | /*119*/ 0, | |||
3410 | 0, | |||
3411 | 0, | |||
3412 | 0, | |||
3413 | MatGetMultiProcBlock_SeqAIJ, | |||
3414 | /*124*/ MatFindNonzeroRows_SeqAIJ, | |||
3415 | MatGetColumnNorms_SeqAIJ, | |||
3416 | MatInvertBlockDiagonal_SeqAIJ, | |||
3417 | MatInvertVariableBlockDiagonal_SeqAIJ, | |||
3418 | 0, | |||
3419 | /*129*/ 0, | |||
3420 | MatTransposeMatMult_SeqAIJ_SeqAIJ, | |||
3421 | MatTransposeMatMultSymbolic_SeqAIJ_SeqAIJ, | |||
3422 | MatTransposeMatMultNumeric_SeqAIJ_SeqAIJ, | |||
3423 | MatTransposeColoringCreate_SeqAIJ, | |||
3424 | /*134*/ MatTransColoringApplySpToDen_SeqAIJ, | |||
3425 | MatTransColoringApplyDenToSp_SeqAIJ, | |||
3426 | MatRARt_SeqAIJ_SeqAIJ, | |||
3427 | MatRARtSymbolic_SeqAIJ_SeqAIJ, | |||
3428 | MatRARtNumeric_SeqAIJ_SeqAIJ, | |||
3429 | /*139*/0, | |||
3430 | 0, | |||
3431 | 0, | |||
3432 | MatFDColoringSetUp_SeqXAIJ, | |||
3433 | MatFindOffBlockDiagonalEntries_SeqAIJ, | |||
3434 | /*144*/MatCreateMPIMatConcatenateSeqMat_SeqAIJ, | |||
3435 | MatDestroySubMatrices_SeqAIJ | |||
3436 | }; | |||
3437 | ||||
3438 | PetscErrorCode MatSeqAIJSetColumnIndices_SeqAIJ(Mat mat,PetscInt *indices) | |||
3439 | { | |||
3440 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data; | |||
3441 | PetscInt i,nz,n; | |||
3442 | ||||
3443 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3443; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3444 | nz = aij->maxnz; | |||
3445 | n = mat->rmap->n; | |||
3446 | for (i=0; i<nz; i++) { | |||
3447 | aij->j[i] = indices[i]; | |||
3448 | } | |||
3449 | aij->nz = nz; | |||
3450 | for (i=0; i<n; i++) { | |||
3451 | aij->ilen[i] = aij->imax[i]; | |||
3452 | } | |||
3453 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3454 | } | |||
3455 | ||||
3456 | /* | |||
3457 | * When a sparse matrix has many zero columns, we should compact them out to save the space | |||
3458 | * This happens in MatPtAPSymbolic_MPIAIJ_MPIAIJ_scalable() | |||
3459 | * */ | |||
3460 | PetscErrorCode MatSeqAIJCompactOutExtraColumns_SeqAIJ(Mat mat, ISLocalToGlobalMapping *mapping) | |||
3461 | { | |||
3462 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data; | |||
3463 | PetscTable gid1_lid1; | |||
3464 | PetscTablePosition tpos; | |||
3465 | PetscInt gid,lid,i,j,ncols,ec; | |||
3466 | PetscInt *garray; | |||
3467 | PetscErrorCode ierr; | |||
3468 | ||||
3469 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3469; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3470 | PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3470, __func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if (((PetscObject)(mat))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),3470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3470,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3471 | PetscValidPointer(mapping,2)do { if (!mapping) return PetscError(((MPI_Comm)0x44000001),3471 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(mapping,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),3471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
3472 | /* use a table */ | |||
3473 | ierr = PetscTableCreate(mat->rmap->n,mat->cmap->N+1,&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3474 | ec = 0; | |||
3475 | for (i=0; i<mat->rmap->n; i++) { | |||
| ||||
3476 | ncols = aij->i[i+1] - aij->i[i]; | |||
3477 | for (j=0; j<ncols; j++) { | |||
3478 | PetscInt data,gid1 = aij->j[aij->i[i] + j] + 1; | |||
3479 | ierr = PetscTableFind(gid1_lid1,gid1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3479,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3480 | if (!data) { | |||
3481 | /* one based table */ | |||
3482 | ierr = PetscTableAdd(gid1_lid1,gid1,++ec,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3482,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3483 | } | |||
3484 | } | |||
3485 | } | |||
3486 | /* form array of columns we need */ | |||
3487 | ierr = PetscMalloc1(ec+1,&garray)PetscMallocA(1,PETSC_FALSE,3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(ec+1)*sizeof(**(&garray)),(&garray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3488 | ierr = PetscTableGetHeadPosition(gid1_lid1,&tpos);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3488,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3489 | while (tpos) { | |||
3490 | ierr = PetscTableGetNext(gid1_lid1,&tpos,&gid,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3491 | gid--; | |||
3492 | lid--; | |||
3493 | garray[lid] = gid; | |||
3494 | } | |||
3495 | ierr = PetscSortInt(ec,garray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3495,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); /* sort, and rebuild */ | |||
3496 | ierr = PetscTableRemoveAll(gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3496,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3497 | for (i=0; i<ec; i++) { | |||
3498 | ierr = PetscTableAdd(gid1_lid1,garray[i]+1,i+1,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3498,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3499 | } | |||
3500 | /* compact out the extra columns in B */ | |||
3501 | for (i=0; i<mat->rmap->n; i++) { | |||
3502 | ncols = aij->i[i+1] - aij->i[i]; | |||
3503 | for (j=0; j<ncols; j++) { | |||
3504 | PetscInt gid1 = aij->j[aij->i[i] + j] + 1; | |||
3505 | ierr = PetscTableFind(gid1_lid1,gid1,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3505,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3506 | lid--; | |||
3507 | aij->j[aij->i[i] + j] = lid; | |||
3508 | } | |||
3509 | } | |||
3510 | mat->cmap->n = mat->cmap->N = ec; | |||
3511 | mat->cmap->bs = 1; | |||
3512 | ||||
3513 | ierr = PetscTableDestroy(&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3513,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3514 | ierr = PetscLayoutSetUp((mat->cmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3514,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3515 | ierr = ISLocalToGlobalMappingCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),mat->cmap->bs,mat->cmap->n,garray,PETSC_OWN_POINTER,mapping);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3515,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3516 | ierr = ISLocalToGlobalMappingSetType(*mapping,ISLOCALTOGLOBALMAPPINGHASH"hash");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3516,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3517 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3518 | } | |||
3519 | ||||
3520 | /*@ | |||
3521 | MatSeqAIJSetColumnIndices - Set the column indices for all the rows | |||
3522 | in the matrix. | |||
3523 | ||||
3524 | Input Parameters: | |||
3525 | + mat - the SeqAIJ matrix | |||
3526 | - indices - the column indices | |||
3527 | ||||
3528 | Level: advanced | |||
3529 | ||||
3530 | Notes: | |||
3531 | This can be called if you have precomputed the nonzero structure of the | |||
3532 | matrix and want to provide it to the matrix object to improve the performance | |||
3533 | of the MatSetValues() operation. | |||
3534 | ||||
3535 | You MUST have set the correct numbers of nonzeros per row in the call to | |||
3536 | MatCreateSeqAIJ(), and the columns indices MUST be sorted. | |||
3537 | ||||
3538 | MUST be called before any calls to MatSetValues(); | |||
3539 | ||||
3540 | The indices should start with zero, not one. | |||
3541 | ||||
3542 | @*/ | |||
3543 | PetscErrorCode MatSeqAIJSetColumnIndices(Mat mat,PetscInt *indices) | |||
3544 | { | |||
3545 | PetscErrorCode ierr; | |||
3546 | ||||
3547 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3547; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3548 | PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3548, __func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3548,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if (((PetscObject)(mat))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),3548,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3548,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3549 | PetscValidPointer(indices,2)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),3549 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(indices,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),3549,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
3550 | ierr = PetscUseMethod(mat,"MatSeqAIJSetColumnIndices_C",(Mat,PetscInt*),(mat,indices))0; do { PetscErrorCode (*f)(Mat,PetscInt*), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)mat),("MatSeqAIJSetColumnIndices_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError (((MPI_Comm)0x44000001),3550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat,indices); do {if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm )0x44000001),3550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0);} else return PetscError(PetscObjectComm ((PetscObject)mat),3550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"MatSeqAIJSetColumnIndices_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3551 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3552 | } | |||
3553 | ||||
3554 | /* ----------------------------------------------------------------------------------------*/ | |||
3555 | ||||
3556 | PetscErrorCode MatStoreValues_SeqAIJ(Mat mat) | |||
3557 | { | |||
3558 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data; | |||
3559 | PetscErrorCode ierr; | |||
3560 | size_t nz = aij->i[mat->rmap->n]; | |||
3561 | ||||
3562 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3562; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3563 | if (!aij->nonew) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first")return PetscError(((MPI_Comm)0x44000001),3563,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first" ); | |||
3564 | ||||
3565 | /* allocate space for values if not already there */ | |||
3566 | if (!aij->saved_values) { | |||
3567 | ierr = PetscMalloc1(nz+1,&aij->saved_values)PetscMallocA(1,PETSC_FALSE,3567,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nz+1)*sizeof(**(&aij->saved_values)),(&aij ->saved_values));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3567,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3568 | ierr = PetscLogObjectMemory((PetscObject)mat,(nz+1)*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3569 | } | |||
3570 | ||||
3571 | /* copy values over */ | |||
3572 | ierr = PetscArraycpy(aij->saved_values,aij->a,nz)((sizeof(*(aij->saved_values)) != sizeof(*(aij->a))) || PetscMemcpy(aij->saved_values,aij->a,(nz)*sizeof(*(aij ->saved_values))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} 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 | /*@ | |||
3577 | MatStoreValues - Stashes a copy of the matrix values; this allows, for | |||
3578 | example, reuse of the linear part of a Jacobian, while recomputing the | |||
3579 | nonlinear portion. | |||
3580 | ||||
3581 | Collect on Mat | |||
3582 | ||||
3583 | Input Parameters: | |||
3584 | . mat - the matrix (currently only AIJ matrices support this option) | |||
3585 | ||||
3586 | Level: advanced | |||
3587 | ||||
3588 | Common Usage, with SNESSolve(): | |||
3589 | $ Create Jacobian matrix | |||
3590 | $ Set linear terms into matrix | |||
3591 | $ Apply boundary conditions to matrix, at this time matrix must have | |||
3592 | $ final nonzero structure (i.e. setting the nonlinear terms and applying | |||
3593 | $ boundary conditions again will not change the nonzero structure | |||
3594 | $ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE); | |||
3595 | $ ierr = MatStoreValues(mat); | |||
3596 | $ Call SNESSetJacobian() with matrix | |||
3597 | $ In your Jacobian routine | |||
3598 | $ ierr = MatRetrieveValues(mat); | |||
3599 | $ Set nonlinear terms in matrix | |||
3600 | ||||
3601 | Common Usage without SNESSolve(), i.e. when you handle nonlinear solve yourself: | |||
3602 | $ // build linear portion of Jacobian | |||
3603 | $ ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE); | |||
3604 | $ ierr = MatStoreValues(mat); | |||
3605 | $ loop over nonlinear iterations | |||
3606 | $ ierr = MatRetrieveValues(mat); | |||
3607 | $ // call MatSetValues(mat,...) to set nonliner portion of Jacobian | |||
3608 | $ // call MatAssemblyBegin/End() on matrix | |||
3609 | $ Solve linear system with Jacobian | |||
3610 | $ endloop | |||
3611 | ||||
3612 | Notes: | |||
3613 | Matrix must already be assemblied before calling this routine | |||
3614 | Must set the matrix option MatSetOption(mat,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE); before | |||
3615 | calling this routine. | |||
3616 | ||||
3617 | When this is called multiple times it overwrites the previous set of stored values | |||
3618 | and does not allocated additional space. | |||
3619 | ||||
3620 | .seealso: MatRetrieveValues() | |||
3621 | ||||
3622 | @*/ | |||
3623 | PetscErrorCode MatStoreValues(Mat mat) | |||
3624 | { | |||
3625 | PetscErrorCode ierr; | |||
3626 | ||||
3627 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3627; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3628 | PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3628, __func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if (((PetscObject)(mat))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),3628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3628,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3629 | if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3629,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix"); | |||
3630 | if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3630,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
3631 | ierr = PetscUseMethod(mat,"MatStoreValues_C",(Mat),(mat))0; do { PetscErrorCode (*f)(Mat), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)mat),("MatStoreValues_C"),(PetscVoidFunction*) (&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError (((MPI_Comm)0x44000001),3631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat);do {if ( __builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),3631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0);} else return PetscError(PetscObjectComm ((PetscObject)mat),3631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"MatStoreValues_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3632 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3633 | } | |||
3634 | ||||
3635 | PetscErrorCode MatRetrieveValues_SeqAIJ(Mat mat) | |||
3636 | { | |||
3637 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)mat->data; | |||
3638 | PetscErrorCode ierr; | |||
3639 | PetscInt nz = aij->i[mat->rmap->n]; | |||
3640 | ||||
3641 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3641; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3642 | if (!aij->nonew) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first")return PetscError(((MPI_Comm)0x44000001),3642,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,58,PETSC_ERROR_INITIAL,"Must call MatSetOption(A,MAT_NEW_NONZERO_LOCATIONS,PETSC_FALSE);first" ); | |||
3643 | if (!aij->saved_values) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER,"Must call MatStoreValues(A);first")return PetscError(((MPI_Comm)0x44000001),3643,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,58,PETSC_ERROR_INITIAL,"Must call MatStoreValues(A);first"); | |||
3644 | /* copy values over */ | |||
3645 | ierr = PetscArraycpy(aij->a,aij->saved_values,nz)((sizeof(*(aij->a)) != sizeof(*(aij->saved_values))) || PetscMemcpy(aij->a,aij->saved_values,(nz)*sizeof(*(aij ->a))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3645,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3646 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3647 | } | |||
3648 | ||||
3649 | /*@ | |||
3650 | MatRetrieveValues - Retrieves the copy of the matrix values; this allows, for | |||
3651 | example, reuse of the linear part of a Jacobian, while recomputing the | |||
3652 | nonlinear portion. | |||
3653 | ||||
3654 | Collect on Mat | |||
3655 | ||||
3656 | Input Parameters: | |||
3657 | . mat - the matrix (currently only AIJ matrices support this option) | |||
3658 | ||||
3659 | Level: advanced | |||
3660 | ||||
3661 | .seealso: MatStoreValues() | |||
3662 | ||||
3663 | @*/ | |||
3664 | PetscErrorCode MatRetrieveValues(Mat mat) | |||
3665 | { | |||
3666 | PetscErrorCode ierr; | |||
3667 | ||||
3668 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3668; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3669 | PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),3669, __func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if (((PetscObject)(mat))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),3669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3669,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3670 | if (!mat->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix")return PetscError(((MPI_Comm)0x44000001),3670,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for unassembled matrix"); | |||
3671 | if (mat->factortype) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix")return PetscError(((MPI_Comm)0x44000001),3671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_INITIAL,"Not for factored matrix"); | |||
3672 | ierr = PetscUseMethod(mat,"MatRetrieveValues_C",(Mat),(mat))0; do { PetscErrorCode (*f)(Mat), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)mat),("MatRetrieveValues_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError (((MPI_Comm)0x44000001),3672,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0); if (f) {__ierr = (*f)(mat);do {if ( __builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),3672,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0);} else return PetscError(PetscObjectComm ((PetscObject)mat),3672,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"MatRetrieveValues_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3672,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3673 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3674 | } | |||
3675 | ||||
3676 | ||||
3677 | /* --------------------------------------------------------------------------------*/ | |||
3678 | /*@C | |||
3679 | MatCreateSeqAIJ - Creates a sparse matrix in AIJ (compressed row) format | |||
3680 | (the default parallel PETSc format). For good matrix assembly performance | |||
3681 | the user should preallocate the matrix storage by setting the parameter nz | |||
3682 | (or the array nnz). By setting these parameters accurately, performance | |||
3683 | during matrix assembly can be increased by more than a factor of 50. | |||
3684 | ||||
3685 | Collective | |||
3686 | ||||
3687 | Input Parameters: | |||
3688 | + comm - MPI communicator, set to PETSC_COMM_SELF | |||
3689 | . m - number of rows | |||
3690 | . n - number of columns | |||
3691 | . nz - number of nonzeros per row (same for all rows) | |||
3692 | - nnz - array containing the number of nonzeros in the various rows | |||
3693 | (possibly different for each row) or NULL | |||
3694 | ||||
3695 | Output Parameter: | |||
3696 | . A - the matrix | |||
3697 | ||||
3698 | It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), | |||
3699 | MatXXXXSetPreallocation() paradigm instead of this routine directly. | |||
3700 | [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation] | |||
3701 | ||||
3702 | Notes: | |||
3703 | If nnz is given then nz is ignored | |||
3704 | ||||
3705 | The AIJ format (also called the Yale sparse matrix format or | |||
3706 | compressed row storage), is fully compatible with standard Fortran 77 | |||
3707 | storage. That is, the stored row and column indices can begin at | |||
3708 | either one (as in Fortran) or zero. See the users' manual for details. | |||
3709 | ||||
3710 | Specify the preallocated storage with either nz or nnz (not both). | |||
3711 | Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory | |||
3712 | allocation. For large problems you MUST preallocate memory or you | |||
3713 | will get TERRIBLE performance, see the users' manual chapter on matrices. | |||
3714 | ||||
3715 | By default, this format uses inodes (identical nodes) when possible, to | |||
3716 | improve numerical efficiency of matrix-vector products and solves. We | |||
3717 | search for consecutive rows with the same nonzero structure, thereby | |||
3718 | reusing matrix information to achieve increased efficiency. | |||
3719 | ||||
3720 | Options Database Keys: | |||
3721 | + -mat_no_inode - Do not use inodes | |||
3722 | - -mat_inode_limit <limit> - Sets inode limit (max limit=5) | |||
3723 | ||||
3724 | Level: intermediate | |||
3725 | ||||
3726 | .seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays() | |||
3727 | ||||
3728 | @*/ | |||
3729 | PetscErrorCode MatCreateSeqAIJ(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A) | |||
3730 | { | |||
3731 | PetscErrorCode ierr; | |||
3732 | ||||
3733 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3733; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3734 | ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3735 | ierr = MatSetSizes(*A,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3735,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3736 | ierr = MatSetType(*A,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3736,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3737 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(*A,nz,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3737,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3738 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3739 | } | |||
3740 | ||||
3741 | /*@C | |||
3742 | MatSeqAIJSetPreallocation - For good matrix assembly performance | |||
3743 | the user should preallocate the matrix storage by setting the parameter nz | |||
3744 | (or the array nnz). By setting these parameters accurately, performance | |||
3745 | during matrix assembly can be increased by more than a factor of 50. | |||
3746 | ||||
3747 | Collective | |||
3748 | ||||
3749 | Input Parameters: | |||
3750 | + B - The matrix | |||
3751 | . nz - number of nonzeros per row (same for all rows) | |||
3752 | - nnz - array containing the number of nonzeros in the various rows | |||
3753 | (possibly different for each row) or NULL | |||
3754 | ||||
3755 | Notes: | |||
3756 | If nnz is given then nz is ignored | |||
3757 | ||||
3758 | The AIJ format (also called the Yale sparse matrix format or | |||
3759 | compressed row storage), is fully compatible with standard Fortran 77 | |||
3760 | storage. That is, the stored row and column indices can begin at | |||
3761 | either one (as in Fortran) or zero. See the users' manual for details. | |||
3762 | ||||
3763 | Specify the preallocated storage with either nz or nnz (not both). | |||
3764 | Set nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory | |||
3765 | allocation. For large problems you MUST preallocate memory or you | |||
3766 | will get TERRIBLE performance, see the users' manual chapter on matrices. | |||
3767 | ||||
3768 | You can call MatGetInfo() to get information on how effective the preallocation was; | |||
3769 | for example the fields mallocs,nz_allocated,nz_used,nz_unneeded; | |||
3770 | You can also run with the option -info and look for messages with the string | |||
3771 | malloc in them to see if additional memory allocation was needed. | |||
3772 | ||||
3773 | Developers: Use nz of MAT_SKIP_ALLOCATION to not allocate any space for the matrix | |||
3774 | entries or columns indices | |||
3775 | ||||
3776 | By default, this format uses inodes (identical nodes) when possible, to | |||
3777 | improve numerical efficiency of matrix-vector products and solves. We | |||
3778 | search for consecutive rows with the same nonzero structure, thereby | |||
3779 | reusing matrix information to achieve increased efficiency. | |||
3780 | ||||
3781 | Options Database Keys: | |||
3782 | + -mat_no_inode - Do not use inodes | |||
3783 | - -mat_inode_limit <limit> - Sets inode limit (max limit=5) | |||
3784 | ||||
3785 | Level: intermediate | |||
3786 | ||||
3787 | .seealso: MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays(), MatGetInfo() | |||
3788 | ||||
3789 | @*/ | |||
3790 | PetscErrorCode MatSeqAIJSetPreallocation(Mat B,PetscInt nz,const PetscInt nnz[]) | |||
3791 | { | |||
3792 | PetscErrorCode ierr; | |||
3793 | ||||
3794 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3794; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3795 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3795,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if ( ((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm )0x44000001),3795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3795,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3796 | PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) do {if (__builtin_expect (!!(73),0)) {PetscError(((MPI_Comm)0x44000001),3796,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",73 ,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73) ;}} while (0); } while (0); | |||
3797 | ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocation_C",(Mat,PetscInt,const PetscInt[]),(B,nz,nnz))0; do { PetscErrorCode (*f)(Mat,PetscInt,const PetscInt[]), __ierr ; __ierr = PetscObjectQueryFunction_Private(((PetscObject)B), ("MatSeqAIJSetPreallocation_C"),(PetscVoidFunction*)(&f)) ;do {if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm )0x44000001),3797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0); if (f) {__ierr = (*f)(B,nz,nnz);do { if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),3797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3798 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3799 | } | |||
3800 | ||||
3801 | PetscErrorCode MatSeqAIJSetPreallocation_SeqAIJ(Mat B,PetscInt nz,const PetscInt *nnz) | |||
3802 | { | |||
3803 | Mat_SeqAIJ *b; | |||
3804 | PetscBool skipallocation = PETSC_FALSE,realalloc = PETSC_FALSE; | |||
3805 | PetscErrorCode ierr; | |||
3806 | PetscInt i; | |||
3807 | ||||
3808 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3808; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3809 | if (nz >= 0 || nnz) realalloc = PETSC_TRUE; | |||
3810 | if (nz == MAT_SKIP_ALLOCATION-4) { | |||
3811 | skipallocation = PETSC_TRUE; | |||
3812 | nz = 0; | |||
3813 | } | |||
3814 | ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3814,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3815 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3815,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3816 | ||||
3817 | if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 5; | |||
3818 | 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),3818,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"nz cannot be less than 0: value %D", nz); | |||
3819 | #if defined(PETSC_USE_DEBUG1) | |||
3820 | if (nnz) { | |||
3821 | for (i=0; i<B->rmap->n; i++) { | |||
3822 | if (nnz[i] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be less than 0: local row %D value %D",i,nnz[i])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),3822,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
3823 | if (nnz[i] > B->cmap->n) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be greater than row length: local row %D value %d rowlength %D",i,nnz[i],B->cmap->n)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),3823,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
3824 | } | |||
3825 | } | |||
3826 | #endif | |||
3827 | ||||
3828 | B->preallocated = PETSC_TRUE; | |||
3829 | ||||
3830 | b = (Mat_SeqAIJ*)B->data; | |||
3831 | ||||
3832 | if (!skipallocation) { | |||
3833 | if (!b->imax) { | |||
3834 | ierr = PetscMalloc1(B->rmap->n,&b->imax)PetscMallocA(1,PETSC_FALSE,3834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(B->rmap->n)*sizeof(**(&b->imax)),(& b->imax));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3835 | ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3835,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3836 | } | |||
3837 | if (!b->ilen) { | |||
3838 | /* b->ilen will count nonzeros in each row so far. */ | |||
3839 | ierr = PetscCalloc1(B->rmap->n,&b->ilen)PetscMallocA(1,PETSC_TRUE,3839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(B->rmap->n)*sizeof(**(&b->ilen)),(& b->ilen));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3840 | ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3840,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3841 | } else { | |||
3842 | ierr = PetscMemzero(b->ilen,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3842,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3843 | } | |||
3844 | if (!b->ipre) { | |||
3845 | ierr = PetscMalloc1(B->rmap->n,&b->ipre)PetscMallocA(1,PETSC_FALSE,3845,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(B->rmap->n)*sizeof(**(&b->ipre)),(& b->ipre));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3845,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3846 | ierr = PetscLogObjectMemory((PetscObject)B,B->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3846,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3847 | } | |||
3848 | if (!nnz) { | |||
3849 | if (nz == PETSC_DEFAULT-2 || nz == PETSC_DECIDE-1) nz = 10; | |||
3850 | else if (nz < 0) nz = 1; | |||
3851 | nz = PetscMin(nz,B->cmap->n)(((nz)<(B->cmap->n)) ? (nz) : (B->cmap->n)); | |||
3852 | for (i=0; i<B->rmap->n; i++) b->imax[i] = nz; | |||
3853 | nz = nz*B->rmap->n; | |||
3854 | } else { | |||
3855 | nz = 0; | |||
3856 | for (i=0; i<B->rmap->n; i++) {b->imax[i] = nnz[i]; nz += nnz[i];} | |||
3857 | } | |||
3858 | ||||
3859 | /* allocate the matrix space */ | |||
3860 | /* FIXME: should B's old memory be unlogged? */ | |||
3861 | ierr = MatSeqXAIJFreeAIJ(B,&b->a,&b->j,&b->i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3862 | if (B->structure_only) { | |||
3863 | ierr = PetscMalloc1(nz,&b->j)PetscMallocA(1,PETSC_FALSE,3863,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nz)*sizeof(**(&b->j)),(&b->j));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3863,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3864 | ierr = PetscMalloc1(B->rmap->n+1,&b->i)PetscMallocA(1,PETSC_FALSE,3864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(B->rmap->n+1)*sizeof(**(&b->i)),(& b->i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3865 | ierr = PetscLogObjectMemory((PetscObject)B,(B->rmap->n+1)*sizeof(PetscInt)+nz*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3865,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3866 | } else { | |||
3867 | ierr = PetscMalloc3(nz,&b->a,nz,&b->j,B->rmap->n+1,&b->i)PetscMallocA(3,PETSC_FALSE,3867,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(nz)*sizeof(**(&b->a)),(&b->a),(size_t )(nz)*sizeof(**(&b->j)),(&b->j),(size_t)(B-> rmap->n+1)*sizeof(**(&b->i)),(&b->i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3867,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3868 | ierr = PetscLogObjectMemory((PetscObject)B,(B->rmap->n+1)*sizeof(PetscInt)+nz*(sizeof(PetscScalar)+sizeof(PetscInt)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3868,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3869 | } | |||
3870 | b->i[0] = 0; | |||
3871 | for (i=1; i<B->rmap->n+1; i++) { | |||
3872 | b->i[i] = b->i[i-1] + b->imax[i-1]; | |||
3873 | } | |||
3874 | if (B->structure_only) { | |||
3875 | b->singlemalloc = PETSC_FALSE; | |||
3876 | b->free_a = PETSC_FALSE; | |||
3877 | } else { | |||
3878 | b->singlemalloc = PETSC_TRUE; | |||
3879 | b->free_a = PETSC_TRUE; | |||
3880 | } | |||
3881 | b->free_ij = PETSC_TRUE; | |||
3882 | } else { | |||
3883 | b->free_a = PETSC_FALSE; | |||
3884 | b->free_ij = PETSC_FALSE; | |||
3885 | } | |||
3886 | ||||
3887 | if (b->ipre && nnz != b->ipre && b->imax) { | |||
3888 | /* reserve user-requested sparsity */ | |||
3889 | ierr = PetscArraycpy(b->ipre,b->imax,B->rmap->n)((sizeof(*(b->ipre)) != sizeof(*(b->imax))) || PetscMemcpy (b->ipre,b->imax,(B->rmap->n)*sizeof(*(b->ipre ))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3889,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3890 | } | |||
3891 | ||||
3892 | ||||
3893 | b->nz = 0; | |||
3894 | b->maxnz = nz; | |||
3895 | B->info.nz_unneeded = (double)b->maxnz; | |||
3896 | if (realalloc) { | |||
3897 | ierr = MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3897,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3898 | } | |||
3899 | B->was_assembled = PETSC_FALSE; | |||
3900 | B->assembled = PETSC_FALSE; | |||
3901 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3902 | } | |||
3903 | ||||
3904 | ||||
3905 | PetscErrorCode MatResetPreallocation_SeqAIJ(Mat A) | |||
3906 | { | |||
3907 | Mat_SeqAIJ *a; | |||
3908 | PetscInt i; | |||
3909 | PetscErrorCode ierr; | |||
3910 | ||||
3911 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3911; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3912 | PetscValidHeaderSpecific(A,MAT_CLASSID,1)do { if (!A) return PetscError(((MPI_Comm)0x44000001),3912,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(A,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(A))->classid != MAT_CLASSID) { if ( ((PetscObject)(A))->classid == -1) return PetscError(((MPI_Comm )0x44000001),3912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3912,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3913 | ||||
3914 | /* Check local size. If zero, then return */ | |||
3915 | if (!A->rmap->n) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3916 | ||||
3917 | a = (Mat_SeqAIJ*)A->data; | |||
3918 | /* if no saved info, we error out */ | |||
3919 | if (!a->ipre) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"No saved preallocation info \n")return PetscError(((MPI_Comm)0x44000001),3919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"No saved preallocation info \n"); | |||
3920 | ||||
3921 | if (!a->i || !a->j || !a->a || !a->imax || !a->ilen) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NULL,"Memory info is incomplete, and can not reset preallocation \n")return PetscError(((MPI_Comm)0x44000001),3921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Memory info is incomplete, and can not reset preallocation \n" ); | |||
3922 | ||||
3923 | ierr = PetscArraycpy(a->imax,a->ipre,A->rmap->n)((sizeof(*(a->imax)) != sizeof(*(a->ipre))) || PetscMemcpy (a->imax,a->ipre,(A->rmap->n)*sizeof(*(a->imax ))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3924 | ierr = PetscArrayzero(a->ilen,A->rmap->n)PetscMemzero(a->ilen,(A->rmap->n)*sizeof(*(a->ilen )));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3924,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3925 | a->i[0] = 0; | |||
3926 | for (i=1; i<A->rmap->n+1; i++) { | |||
3927 | a->i[i] = a->i[i-1] + a->imax[i-1]; | |||
3928 | } | |||
3929 | A->preallocated = PETSC_TRUE; | |||
3930 | a->nz = 0; | |||
3931 | a->maxnz = a->i[A->rmap->n]; | |||
3932 | A->info.nz_unneeded = (double)a->maxnz; | |||
3933 | A->was_assembled = PETSC_FALSE; | |||
3934 | A->assembled = PETSC_FALSE; | |||
3935 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3936 | } | |||
3937 | ||||
3938 | /*@ | |||
3939 | MatSeqAIJSetPreallocationCSR - Allocates memory for a sparse sequential matrix in AIJ format. | |||
3940 | ||||
3941 | Input Parameters: | |||
3942 | + B - the matrix | |||
3943 | . i - the indices into j for the start of each row (starts with zero) | |||
3944 | . j - the column indices for each row (starts with zero) these must be sorted for each row | |||
3945 | - v - optional values in the matrix | |||
3946 | ||||
3947 | Level: developer | |||
3948 | ||||
3949 | The i,j,v values are COPIED with this routine; to avoid the copy use MatCreateSeqAIJWithArrays() | |||
3950 | ||||
3951 | .seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatSeqAIJSetPreallocation(), MatCreateSeqAIJ(), MATSEQAIJ | |||
3952 | @*/ | |||
3953 | PetscErrorCode MatSeqAIJSetPreallocationCSR(Mat B,const PetscInt i[],const PetscInt j[],const PetscScalar v[]) | |||
3954 | { | |||
3955 | PetscErrorCode ierr; | |||
3956 | ||||
3957 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3957; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3958 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),3958,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),3958,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if ( ((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm )0x44000001),3958,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),3958,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
3959 | PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) do {if (__builtin_expect (!!(73),0)) {PetscError(((MPI_Comm)0x44000001),3959,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",73 ,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001),73) ;}} while (0); } while (0); | |||
3960 | ierr = PetscTryMethod(B,"MatSeqAIJSetPreallocationCSR_C",(Mat,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,i,j,v))0; do { PetscErrorCode (*f)(Mat,const PetscInt[],const PetscInt [],const PetscScalar[]), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)B),("MatSeqAIJSetPreallocationCSR_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) {PetscError (((MPI_Comm)0x44000001),3960,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0); if (f) {__ierr = (*f)(B,i,j,v);do { if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),3960,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0);} } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3960,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3961 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3962 | } | |||
3963 | ||||
3964 | PetscErrorCode MatSeqAIJSetPreallocationCSR_SeqAIJ(Mat B,const PetscInt Ii[],const PetscInt J[],const PetscScalar v[]) | |||
3965 | { | |||
3966 | PetscInt i; | |||
3967 | PetscInt m,n; | |||
3968 | PetscInt nz; | |||
3969 | PetscInt *nnz, nz_max = 0; | |||
3970 | PetscErrorCode ierr; | |||
3971 | ||||
3972 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 3972; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3973 | if (Ii[0]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE, "Ii[0] must be 0 it is %D", Ii[0])return PetscError(((MPI_Comm)0x44000001),3973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"Ii[0] must be 0 it is %D",Ii[0]); | |||
3974 | ||||
3975 | ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3975,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3976 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3977 | ||||
3978 | ierr = MatGetSize(B, &m, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3978,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3979 | ierr = PetscMalloc1(m+1, &nnz)PetscMallocA(1,PETSC_FALSE,3979,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m+1)*sizeof(**(&nnz)),(&nnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3979,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3980 | for (i = 0; i < m; i++) { | |||
3981 | nz = Ii[i+1]- Ii[i]; | |||
3982 | nz_max = PetscMax(nz_max, nz)(((nz_max)<(nz)) ? (nz) : (nz_max)); | |||
3983 | if (nz < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE, "Local row %D has a negative number of columns %D", i, nnz)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),3983,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
3984 | nnz[i] = nz; | |||
3985 | } | |||
3986 | ierr = MatSeqAIJSetPreallocation(B, 0, nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3987 | ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),3987,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((nnz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3987,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3988 | ||||
3989 | for (i = 0; i < m; i++) { | |||
3990 | ierr = MatSetValues_SeqAIJ(B, 1, &i, Ii[i+1] - Ii[i], J+Ii[i], v ? v + Ii[i] : NULL((void*)0), INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3990,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3991 | } | |||
3992 | ||||
3993 | ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3993,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3994 | ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3994,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3995 | ||||
3996 | ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),3996,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
3997 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3998 | } | |||
3999 | ||||
4000 | #include <../src/mat/impls/dense/seq/dense.h> | |||
4001 | #include <petsc/private/kernels/petscaxpy.h> | |||
4002 | ||||
4003 | /* | |||
4004 | Computes (B'*A')' since computing B*A directly is untenable | |||
4005 | ||||
4006 | n p p | |||
4007 | ( ) ( ) ( ) | |||
4008 | m ( A ) * n ( B ) = m ( C ) | |||
4009 | ( ) ( ) ( ) | |||
4010 | ||||
4011 | */ | |||
4012 | PetscErrorCode MatMatMultNumeric_SeqDense_SeqAIJ(Mat A,Mat B,Mat C) | |||
4013 | { | |||
4014 | PetscErrorCode ierr; | |||
4015 | Mat_SeqDense *sub_a = (Mat_SeqDense*)A->data; | |||
4016 | Mat_SeqAIJ *sub_b = (Mat_SeqAIJ*)B->data; | |||
4017 | Mat_SeqDense *sub_c = (Mat_SeqDense*)C->data; | |||
4018 | PetscInt i,n,m,q,p; | |||
4019 | const PetscInt *ii,*idx; | |||
4020 | const PetscScalar *b,*a,*a_q; | |||
4021 | PetscScalar *c,*c_q; | |||
4022 | ||||
4023 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4023; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4024 | m = A->rmap->n; | |||
4025 | n = A->cmap->n; | |||
4026 | p = B->cmap->n; | |||
4027 | a = sub_a->v; | |||
4028 | b = sub_b->a; | |||
4029 | c = sub_c->v; | |||
4030 | ierr = PetscArrayzero(c,m*p)PetscMemzero(c,(m*p)*sizeof(*(c)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4030,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4031 | ||||
4032 | ii = sub_b->i; | |||
4033 | idx = sub_b->j; | |||
4034 | for (i=0; i<n; i++) { | |||
4035 | q = ii[i+1] - ii[i]; | |||
4036 | while (q-->0) { | |||
4037 | c_q = c + m*(*idx); | |||
4038 | a_q = a + m*i; | |||
4039 | PetscKernelAXPY(c_q,*b,a_q,m){PetscInt __i;PetscScalar _a1=*b; for (__i=0;__i<m;__i++)c_q [__i]+=_a1 * a_q[__i];}; | |||
4040 | idx++; | |||
4041 | b++; | |||
4042 | } | |||
4043 | } | |||
4044 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4045 | } | |||
4046 | ||||
4047 | PetscErrorCode MatMatMultSymbolic_SeqDense_SeqAIJ(Mat A,Mat B,PetscReal fill,Mat *C) | |||
4048 | { | |||
4049 | PetscErrorCode ierr; | |||
4050 | PetscInt m=A->rmap->n,n=B->cmap->n; | |||
4051 | Mat Cmat; | |||
4052 | ||||
4053 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4053; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4054 | if (A->cmap->n != B->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"A->cmap->n %D != B->rmap->n %D\n",A->cmap->n,B->rmap->n)do {if (__builtin_expect(!!(60),0)) {PetscError(((MPI_Comm)0x44000001 ),4054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 60);}} while (0); | |||
4055 | ierr = MatCreate(PetscObjectComm((PetscObject)A),&Cmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4055,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4056 | ierr = MatSetSizes(Cmat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4057 | ierr = MatSetBlockSizesFromMats(Cmat,A,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4057,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4058 | ierr = MatSetType(Cmat,MATSEQDENSE"seqdense");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4058,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4059 | ierr = MatSeqDenseSetPreallocation(Cmat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4059,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4060 | ||||
4061 | Cmat->ops->matmultnumeric = MatMatMultNumeric_SeqDense_SeqAIJ; | |||
4062 | ||||
4063 | *C = Cmat; | |||
4064 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4065 | } | |||
4066 | ||||
4067 | /* ----------------------------------------------------------------*/ | |||
4068 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMult_SeqDense_SeqAIJ(Mat A,Mat B,MatReuse scall,PetscReal fill,Mat *C) | |||
4069 | { | |||
4070 | PetscErrorCode ierr; | |||
4071 | ||||
4072 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4072; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4073 | if (scall == MAT_INITIAL_MATRIX) { | |||
4074 | ierr = PetscLogEventBegin(MAT_MatMultSymbolic,A,B,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [MAT_MatMultSymbolic].active) ? (*PetscLogPLB)((MAT_MatMultSymbolic ),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4074,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4075 | ierr = MatMatMultSymbolic_SeqDense_SeqAIJ(A,B,fill,C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4075,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4076 | ierr = PetscLogEventEnd(MAT_MatMultSymbolic,A,B,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [MAT_MatMultSymbolic].active) ? (*PetscLogPLE)((MAT_MatMultSymbolic ),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4076,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4077 | } | |||
4078 | ierr = PetscLogEventBegin(MAT_MatMultNumeric,A,B,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [MAT_MatMultNumeric].active) ? (*PetscLogPLB)((MAT_MatMultNumeric ),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4078,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4079 | ierr = MatMatMultNumeric_SeqDense_SeqAIJ(A,B,*C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4079,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4080 | ierr = PetscLogEventEnd(MAT_MatMultNumeric,A,B,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [MAT_MatMultNumeric].active) ? (*PetscLogPLE)((MAT_MatMultNumeric ),0,(PetscObject)(A),(PetscObject)(B),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4080,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4081 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4082 | } | |||
4083 | ||||
4084 | ||||
4085 | /*MC | |||
4086 | MATSEQAIJ - MATSEQAIJ = "seqaij" - A matrix type to be used for sequential sparse matrices, | |||
4087 | based on compressed sparse row format. | |||
4088 | ||||
4089 | Options Database Keys: | |||
4090 | . -mat_type seqaij - sets the matrix type to "seqaij" during a call to MatSetFromOptions() | |||
4091 | ||||
4092 | Level: beginner | |||
4093 | ||||
4094 | .seealso: MatCreateSeqAIJ(), MatSetFromOptions(), MatSetType(), MatCreate(), MatType | |||
4095 | M*/ | |||
4096 | ||||
4097 | /*MC | |||
4098 | MATAIJ - MATAIJ = "aij" - A matrix type to be used for sparse matrices. | |||
4099 | ||||
4100 | This matrix type is identical to MATSEQAIJ when constructed with a single process communicator, | |||
4101 | and MATMPIAIJ otherwise. As a result, for single process communicators, | |||
4102 | MatSeqAIJSetPreallocation is supported, and similarly MatMPIAIJSetPreallocation is supported | |||
4103 | for communicators controlling multiple processes. It is recommended that you call both of | |||
4104 | the above preallocation routines for simplicity. | |||
4105 | ||||
4106 | Options Database Keys: | |||
4107 | . -mat_type aij - sets the matrix type to "aij" during a call to MatSetFromOptions() | |||
4108 | ||||
4109 | Developer Notes: | |||
4110 | Subclasses include MATAIJCUSPARSE, MATAIJPERM, MATAIJSELL, MATAIJMKL, MATAIJCRL, and also automatically switches over to use inodes when | |||
4111 | enough exist. | |||
4112 | ||||
4113 | Level: beginner | |||
4114 | ||||
4115 | .seealso: MatCreateAIJ(), MatCreateSeqAIJ(), MATSEQAIJ,MATMPIAIJ | |||
4116 | M*/ | |||
4117 | ||||
4118 | /*MC | |||
4119 | MATAIJCRL - MATAIJCRL = "aijcrl" - A matrix type to be used for sparse matrices. | |||
4120 | ||||
4121 | This matrix type is identical to MATSEQAIJCRL when constructed with a single process communicator, | |||
4122 | and MATMPIAIJCRL otherwise. As a result, for single process communicators, | |||
4123 | MatSeqAIJSetPreallocation() is supported, and similarly MatMPIAIJSetPreallocation() is supported | |||
4124 | for communicators controlling multiple processes. It is recommended that you call both of | |||
4125 | the above preallocation routines for simplicity. | |||
4126 | ||||
4127 | Options Database Keys: | |||
4128 | . -mat_type aijcrl - sets the matrix type to "aijcrl" during a call to MatSetFromOptions() | |||
4129 | ||||
4130 | Level: beginner | |||
4131 | ||||
4132 | .seealso: MatCreateMPIAIJCRL,MATSEQAIJCRL,MATMPIAIJCRL, MATSEQAIJCRL, MATMPIAIJCRL | |||
4133 | M*/ | |||
4134 | ||||
4135 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCRL(Mat,MatType,MatReuse,Mat*); | |||
4136 | #if defined(PETSC_HAVE_ELEMENTAL) | |||
4137 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_Elemental(Mat,MatType,MatReuse,Mat*); | |||
4138 | #endif | |||
4139 | #if defined(PETSC_HAVE_HYPRE) | |||
4140 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_AIJ_HYPRE(Mat A,MatType,MatReuse,Mat*); | |||
4141 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatMatMatMult_Transpose_AIJ_AIJ(Mat,Mat,Mat,MatReuse,PetscReal,Mat*); | |||
4142 | #endif | |||
4143 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_SeqAIJ_SeqDense(Mat,MatType,MatReuse,Mat*); | |||
4144 | ||||
4145 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqSELL(Mat,MatType,MatReuse,Mat*); | |||
4146 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_XAIJ_IS(Mat,MatType,MatReuse,Mat*); | |||
4147 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatPtAP_IS_XAIJ(Mat,Mat,MatReuse,PetscReal,Mat*); | |||
4148 | ||||
4149 | /*@C | |||
4150 | MatSeqAIJGetArray - gives access to the array where the data for a MATSEQAIJ matrix is stored | |||
4151 | ||||
4152 | Not Collective | |||
4153 | ||||
4154 | Input Parameter: | |||
4155 | . mat - a MATSEQAIJ matrix | |||
4156 | ||||
4157 | Output Parameter: | |||
4158 | . array - pointer to the data | |||
4159 | ||||
4160 | Level: intermediate | |||
4161 | ||||
4162 | .seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90() | |||
4163 | @*/ | |||
4164 | PetscErrorCode MatSeqAIJGetArray(Mat A,PetscScalar **array) | |||
4165 | { | |||
4166 | PetscErrorCode ierr; | |||
4167 | ||||
4168 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4168; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4169 | ierr = PetscUseMethod(A,"MatSeqAIJGetArray_C",(Mat,PetscScalar**),(A,array))0; do { PetscErrorCode (*f)(Mat,PetscScalar**), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)A),("MatSeqAIJGetArray_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) {PetscError(((MPI_Comm)0x44000001),4169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0); if (f) {__ierr = (*f)(A,array);do { if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),4169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0);} else return PetscError(PetscObjectComm ((PetscObject)A),4169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"MatSeqAIJGetArray_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4170 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4171 | } | |||
4172 | ||||
4173 | /*@C | |||
4174 | MatSeqAIJGetMaxRowNonzeros - returns the maximum number of nonzeros in any row | |||
4175 | ||||
4176 | Not Collective | |||
4177 | ||||
4178 | Input Parameter: | |||
4179 | . mat - a MATSEQAIJ matrix | |||
4180 | ||||
4181 | Output Parameter: | |||
4182 | . nz - the maximum number of nonzeros in any row | |||
4183 | ||||
4184 | Level: intermediate | |||
4185 | ||||
4186 | .seealso: MatSeqAIJRestoreArray(), MatSeqAIJGetArrayF90() | |||
4187 | @*/ | |||
4188 | PetscErrorCode MatSeqAIJGetMaxRowNonzeros(Mat A,PetscInt *nz) | |||
4189 | { | |||
4190 | Mat_SeqAIJ *aij = (Mat_SeqAIJ*)A->data; | |||
4191 | ||||
4192 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4192; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4193 | *nz = aij->rmax; | |||
4194 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4195 | } | |||
4196 | ||||
4197 | /*@C | |||
4198 | MatSeqAIJRestoreArray - returns access to the array where the data for a MATSEQAIJ matrix is stored obtained by MatSeqAIJGetArray() | |||
4199 | ||||
4200 | Not Collective | |||
4201 | ||||
4202 | Input Parameters: | |||
4203 | + mat - a MATSEQAIJ matrix | |||
4204 | - array - pointer to the data | |||
4205 | ||||
4206 | Level: intermediate | |||
4207 | ||||
4208 | .seealso: MatSeqAIJGetArray(), MatSeqAIJRestoreArrayF90() | |||
4209 | @*/ | |||
4210 | PetscErrorCode MatSeqAIJRestoreArray(Mat A,PetscScalar **array) | |||
4211 | { | |||
4212 | PetscErrorCode ierr; | |||
4213 | ||||
4214 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4214; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4215 | ierr = PetscUseMethod(A,"MatSeqAIJRestoreArray_C",(Mat,PetscScalar**),(A,array))0; do { PetscErrorCode (*f)(Mat,PetscScalar**), __ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject)A),("MatSeqAIJRestoreArray_C" ),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr ),0)) {PetscError(((MPI_Comm)0x44000001),4215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0); if (f) {__ierr = (*f)(A,array);do { if (__builtin_expect(!!(__ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),4215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,__ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),__ierr);}} while (0);} else return PetscError(PetscObjectComm ((PetscObject)A),4215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_INITIAL,"Cannot locate function %s in object" ,"MatSeqAIJRestoreArray_C"); } while(0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4216 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4217 | } | |||
4218 | ||||
4219 | #if defined(PETSC_HAVE_CUDA) | |||
4220 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatConvert_SeqAIJ_SeqAIJCUSPARSE(Mat); | |||
4221 | #endif | |||
4222 | ||||
4223 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_SeqAIJ(Mat B) | |||
4224 | { | |||
4225 | Mat_SeqAIJ *b; | |||
4226 | PetscErrorCode ierr; | |||
4227 | PetscMPIInt size; | |||
4228 | ||||
4229 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4229; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4230 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4230,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4231 | if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Comm must be of size 1")return PetscError(((MPI_Comm)0x44000001),4231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"Comm must be of size 1"); | |||
4232 | ||||
4233 | ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,4233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(1)*sizeof(**(((&b)))),(((&b)))) || PetscLogObjectMemory ((PetscObject)B,sizeof(**(&b))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4234 | ||||
4235 | B->data = (void*)b; | |||
4236 | ||||
4237 | ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4237,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4238 | if (B->sortedfull) B->ops->setvalues = MatSetValues_SeqAIJ_SortedFull; | |||
4239 | ||||
4240 | b->row = 0; | |||
4241 | b->col = 0; | |||
4242 | b->icol = 0; | |||
4243 | b->reallocs = 0; | |||
4244 | b->ignorezeroentries = PETSC_FALSE; | |||
4245 | b->roworiented = PETSC_TRUE; | |||
4246 | b->nonew = 0; | |||
4247 | b->diag = 0; | |||
4248 | b->solve_work = 0; | |||
4249 | B->spptr = 0; | |||
4250 | b->saved_values = 0; | |||
4251 | b->idiag = 0; | |||
4252 | b->mdiag = 0; | |||
4253 | b->ssor_work = 0; | |||
4254 | b->omega = 1.0; | |||
4255 | b->fshift = 0.0; | |||
4256 | b->idiagvalid = PETSC_FALSE; | |||
4257 | b->ibdiagvalid = PETSC_FALSE; | |||
4258 | b->keepnonzeropattern = PETSC_FALSE; | |||
4259 | ||||
4260 | ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4261 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJGetArray_C",MatSeqAIJGetArray_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJGetArray_C" ,(PetscVoidFunction)(MatSeqAIJGetArray_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4262 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJRestoreArray_C",MatSeqAIJRestoreArray_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJRestoreArray_C" ,(PetscVoidFunction)(MatSeqAIJRestoreArray_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4263 | ||||
4264 | #if defined(PETSC_HAVE_MATLAB_ENGINE) | |||
4265 | ierr = PetscObjectComposeFunction((PetscObject)B,"PetscMatlabEnginePut_C",MatlabEnginePut_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"PetscMatlabEnginePut_C" ,(PetscVoidFunction)(MatlabEnginePut_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4265,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4266 | ierr = PetscObjectComposeFunction((PetscObject)B,"PetscMatlabEngineGet_C",MatlabEngineGet_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"PetscMatlabEngineGet_C" ,(PetscVoidFunction)(MatlabEngineGet_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4266,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4267 | #endif | |||
4268 | ||||
4269 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJSetColumnIndices_C",MatSeqAIJSetColumnIndices_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJSetColumnIndices_C" ,(PetscVoidFunction)(MatSeqAIJSetColumnIndices_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4269,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4270 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatStoreValues_C",MatStoreValues_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatStoreValues_C" ,(PetscVoidFunction)(MatStoreValues_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4270,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4271 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatRetrieveValues_C",MatRetrieveValues_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatRetrieveValues_C" ,(PetscVoidFunction)(MatRetrieveValues_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4272 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqsbaij_C",MatConvert_SeqAIJ_SeqSBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqsbaij_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqSBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4273 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqbaij_C",MatConvert_SeqAIJ_SeqBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqbaij_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4274 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijperm_C",MatConvert_SeqAIJ_SeqAIJPERM)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijperm_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJPERM));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4274,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4275 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijsell_C",MatConvert_SeqAIJ_SeqAIJSELL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijsell_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJSELL));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4275,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4276 | #if defined(PETSC_HAVE_MKL_SPARSE) | |||
4277 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijmkl_C",MatConvert_SeqAIJ_SeqAIJMKL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijmkl_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJMKL));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4277,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4278 | #endif | |||
4279 | #if defined(PETSC_HAVE_CUDA) | |||
4280 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijcusparse_C",MatConvert_SeqAIJ_SeqAIJCUSPARSE)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijcusparse_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJCUSPARSE));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4280,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4281 | #endif | |||
4282 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqaijcrl_C",MatConvert_SeqAIJ_SeqAIJCRL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqaijcrl_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqAIJCRL));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4282,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4283 | #if defined(PETSC_HAVE_ELEMENTAL) | |||
4284 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_elemental_C",MatConvert_SeqAIJ_Elemental)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_elemental_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_Elemental));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4284,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4285 | #endif | |||
4286 | #if defined(PETSC_HAVE_HYPRE) | |||
4287 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_hypre_C",MatConvert_AIJ_HYPRE)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_hypre_C" ,(PetscVoidFunction)(MatConvert_AIJ_HYPRE));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4288 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMatMult_transpose_seqaij_seqaij_C",MatMatMatMult_Transpose_AIJ_AIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMatMult_transpose_seqaij_seqaij_C" ,(PetscVoidFunction)(MatMatMatMult_Transpose_AIJ_AIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4288,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4289 | #endif | |||
4290 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqdense_C",MatConvert_SeqAIJ_SeqDense)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqdense_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqDense));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4290,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4291 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_seqsell_C",MatConvert_SeqAIJ_SeqSELL)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_seqsell_C" ,(PetscVoidFunction)(MatConvert_SeqAIJ_SeqSELL));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4291,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4292 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_seqaij_is_C",MatConvert_XAIJ_IS)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_seqaij_is_C" ,(PetscVoidFunction)(MatConvert_XAIJ_IS));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4292,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4293 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatIsTranspose_C",MatIsTranspose_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatIsTranspose_C" ,(PetscVoidFunction)(MatIsTranspose_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4293,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4294 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatIsHermitianTranspose_C",MatIsTranspose_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatIsHermitianTranspose_C" ,(PetscVoidFunction)(MatIsTranspose_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4295 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJSetPreallocation_C",MatSeqAIJSetPreallocation_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJSetPreallocation_C" ,(PetscVoidFunction)(MatSeqAIJSetPreallocation_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4296 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatResetPreallocation_C",MatResetPreallocation_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatResetPreallocation_C" ,(PetscVoidFunction)(MatResetPreallocation_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4297 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatSeqAIJSetPreallocationCSR_C",MatSeqAIJSetPreallocationCSR_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatSeqAIJSetPreallocationCSR_C" ,(PetscVoidFunction)(MatSeqAIJSetPreallocationCSR_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4298 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatReorderForNonzeroDiagonal_C",MatReorderForNonzeroDiagonal_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatReorderForNonzeroDiagonal_C" ,(PetscVoidFunction)(MatReorderForNonzeroDiagonal_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4298,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4299 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMult_seqdense_seqaij_C",MatMatMult_SeqDense_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMult_seqdense_seqaij_C" ,(PetscVoidFunction)(MatMatMult_SeqDense_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4300 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMultSymbolic_seqdense_seqaij_C",MatMatMultSymbolic_SeqDense_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMultSymbolic_seqdense_seqaij_C" ,(PetscVoidFunction)(MatMatMultSymbolic_SeqDense_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4300,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4301 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatMatMultNumeric_seqdense_seqaij_C",MatMatMultNumeric_SeqDense_SeqAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMatMultNumeric_seqdense_seqaij_C" ,(PetscVoidFunction)(MatMatMultNumeric_SeqDense_SeqAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4302 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatPtAP_is_seqaij_C",MatPtAP_IS_XAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatPtAP_is_seqaij_C" ,(PetscVoidFunction)(MatPtAP_IS_XAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4302,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4303 | ierr = MatCreate_SeqAIJ_Inode(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4304 | ierr = PetscObjectChangeTypeName((PetscObject)B,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4305 | ierr = MatSeqAIJSetTypeFromOptions(B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4305,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); /* this allows changing the matrix subtype to say MATSEQAIJPERM */ | |||
4306 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4307 | } | |||
4308 | ||||
4309 | /* | |||
4310 | Given a matrix generated with MatGetFactor() duplicates all the information in A into B | |||
4311 | */ | |||
4312 | PetscErrorCode MatDuplicateNoCreate_SeqAIJ(Mat C,Mat A,MatDuplicateOption cpvalues,PetscBool mallocmatspace) | |||
4313 | { | |||
4314 | Mat_SeqAIJ *c,*a = (Mat_SeqAIJ*)A->data; | |||
4315 | PetscErrorCode ierr; | |||
4316 | PetscInt m = A->rmap->n,i; | |||
4317 | ||||
4318 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4318; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4319 | c = (Mat_SeqAIJ*)C->data; | |||
4320 | ||||
4321 | C->factortype = A->factortype; | |||
4322 | c->row = 0; | |||
4323 | c->col = 0; | |||
4324 | c->icol = 0; | |||
4325 | c->reallocs = 0; | |||
4326 | ||||
4327 | C->assembled = PETSC_TRUE; | |||
4328 | ||||
4329 | ierr = PetscLayoutReference(A->rmap,&C->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4330 | ierr = PetscLayoutReference(A->cmap,&C->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4331 | ||||
4332 | ierr = PetscMalloc1(m,&c->imax)PetscMallocA(1,PETSC_FALSE,4332,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m)*sizeof(**(&c->imax)),(&c->imax));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4332,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4333 | ierr = PetscMemcpy(c->imax,a->imax,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4333,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4334 | ierr = PetscMalloc1(m,&c->ilen)PetscMallocA(1,PETSC_FALSE,4334,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m)*sizeof(**(&c->ilen)),(&c->ilen));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4334,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4335 | ierr = PetscMemcpy(c->ilen,a->ilen,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4335,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4336 | ierr = PetscLogObjectMemory((PetscObject)C, 2*m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4337 | ||||
4338 | /* allocate the matrix space */ | |||
4339 | if (mallocmatspace) { | |||
4340 | ierr = PetscMalloc3(a->i[m],&c->a,a->i[m],&c->j,m+1,&c->i)PetscMallocA(3,PETSC_FALSE,4340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(a->i[m])*sizeof(**(&c->a)),(&c->a) ,(size_t)(a->i[m])*sizeof(**(&c->j)),(&c->j) ,(size_t)(m+1)*sizeof(**(&c->i)),(&c->i));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4341 | ierr = PetscLogObjectMemory((PetscObject)C, a->i[m]*(sizeof(PetscScalar)+sizeof(PetscInt))+(m+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4341,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4342 | ||||
4343 | c->singlemalloc = PETSC_TRUE; | |||
4344 | ||||
4345 | ierr = PetscArraycpy(c->i,a->i,m+1)((sizeof(*(c->i)) != sizeof(*(a->i))) || PetscMemcpy(c-> i,a->i,(m+1)*sizeof(*(c->i))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4345,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4346 | if (m > 0) { | |||
4347 | ierr = PetscArraycpy(c->j,a->j,a->i[m])((sizeof(*(c->j)) != sizeof(*(a->j))) || PetscMemcpy(c-> j,a->j,(a->i[m])*sizeof(*(c->j))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4348 | if (cpvalues == MAT_COPY_VALUES) { | |||
4349 | ierr = PetscArraycpy(c->a,a->a,a->i[m])((sizeof(*(c->a)) != sizeof(*(a->a))) || PetscMemcpy(c-> a,a->a,(a->i[m])*sizeof(*(c->a))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4349,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4350 | } else { | |||
4351 | ierr = PetscArrayzero(c->a,a->i[m])PetscMemzero(c->a,(a->i[m])*sizeof(*(c->a)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4351,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4352 | } | |||
4353 | } | |||
4354 | } | |||
4355 | ||||
4356 | c->ignorezeroentries = a->ignorezeroentries; | |||
4357 | c->roworiented = a->roworiented; | |||
4358 | c->nonew = a->nonew; | |||
4359 | if (a->diag) { | |||
4360 | ierr = PetscMalloc1(m+1,&c->diag)PetscMallocA(1,PETSC_FALSE,4360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m+1)*sizeof(**(&c->diag)),(&c->diag));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4361 | ierr = PetscMemcpy(c->diag,a->diag,m*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4362 | ierr = PetscLogObjectMemory((PetscObject)C,(m+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4362,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4363 | } else c->diag = NULL((void*)0); | |||
4364 | ||||
4365 | c->solve_work = 0; | |||
4366 | c->saved_values = 0; | |||
4367 | c->idiag = 0; | |||
4368 | c->ssor_work = 0; | |||
4369 | c->keepnonzeropattern = a->keepnonzeropattern; | |||
4370 | c->free_a = PETSC_TRUE; | |||
4371 | c->free_ij = PETSC_TRUE; | |||
4372 | ||||
4373 | c->rmax = a->rmax; | |||
4374 | c->nz = a->nz; | |||
4375 | c->maxnz = a->nz; /* Since we allocate exactly the right amount */ | |||
4376 | C->preallocated = PETSC_TRUE; | |||
4377 | ||||
4378 | c->compressedrow.use = a->compressedrow.use; | |||
4379 | c->compressedrow.nrows = a->compressedrow.nrows; | |||
4380 | if (a->compressedrow.use) { | |||
4381 | i = a->compressedrow.nrows; | |||
4382 | ierr = PetscMalloc2(i+1,&c->compressedrow.i,i,&c->compressedrow.rindex)PetscMallocA(2,PETSC_FALSE,4382,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(i+1)*sizeof(**(&c->compressedrow.i)),(&c ->compressedrow.i),(size_t)(i)*sizeof(**(&c->compressedrow .rindex)),(&c->compressedrow.rindex));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4382,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4383 | ierr = PetscArraycpy(c->compressedrow.i,a->compressedrow.i,i+1)((sizeof(*(c->compressedrow.i)) != sizeof(*(a->compressedrow .i))) || PetscMemcpy(c->compressedrow.i,a->compressedrow .i,(i+1)*sizeof(*(c->compressedrow.i))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4383,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4384 | ierr = PetscArraycpy(c->compressedrow.rindex,a->compressedrow.rindex,i)((sizeof(*(c->compressedrow.rindex)) != sizeof(*(a->compressedrow .rindex))) || PetscMemcpy(c->compressedrow.rindex,a->compressedrow .rindex,(i)*sizeof(*(c->compressedrow.rindex))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4384,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4385 | } else { | |||
4386 | c->compressedrow.use = PETSC_FALSE; | |||
4387 | c->compressedrow.i = NULL((void*)0); | |||
4388 | c->compressedrow.rindex = NULL((void*)0); | |||
4389 | } | |||
4390 | c->nonzerorowcnt = a->nonzerorowcnt; | |||
4391 | C->nonzerostate = A->nonzerostate; | |||
4392 | ||||
4393 | ierr = MatDuplicate_SeqAIJ_Inode(A,cpvalues,&C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4394 | ierr = PetscFunctionListDuplicate(((PetscObject)A)->qlist,&((PetscObject)C)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4394,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4395 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4396 | } | |||
4397 | ||||
4398 | PetscErrorCode MatDuplicate_SeqAIJ(Mat A,MatDuplicateOption cpvalues,Mat *B) | |||
4399 | { | |||
4400 | PetscErrorCode ierr; | |||
4401 | ||||
4402 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4402; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4403 | ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4403,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4404 | ierr = MatSetSizes(*B,A->rmap->n,A->cmap->n,A->rmap->n,A->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4404,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4405 | if (!(A->rmap->n % A->rmap->bs) && !(A->cmap->n % A->cmap->bs)) { | |||
4406 | ierr = MatSetBlockSizesFromMats(*B,A,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4406,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4407 | } | |||
4408 | ierr = MatSetType(*B,((PetscObject)A)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4408,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4409 | ierr = MatDuplicateNoCreate_SeqAIJ(*B,A,cpvalues,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4409,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4410 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4411 | } | |||
4412 | ||||
4413 | PetscErrorCode MatLoad_SeqAIJ(Mat newMat, PetscViewer viewer) | |||
4414 | { | |||
4415 | PetscBool isbinary, ishdf5; | |||
4416 | PetscErrorCode ierr; | |||
4417 | ||||
4418 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4418; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4419 | PetscValidHeaderSpecific(newMat,MAT_CLASSID,1)do { if (!newMat) return PetscError(((MPI_Comm)0x44000001),4419 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(newMat,PETSC_OBJECT)) return PetscError((( MPI_Comm)0x44000001),4419,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(newMat))->classid != MAT_CLASSID) { if (((PetscObject)(newMat))->classid == -1) return PetscError (((MPI_Comm)0x44000001),4419,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),4419,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
4420 | PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),4420 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if ( !PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError((( MPI_Comm)0x44000001),4420,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,2); if (((PetscObject)(viewer))->classid != PETSC_VIEWER_CLASSID ) { if (((PetscObject)(viewer))->classid == -1) return PetscError (((MPI_Comm)0x44000001),4420,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,2); else return PetscError(((MPI_Comm)0x44000001),4420,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,2); } } while (0); | |||
4421 | /* force binary viewer to load .info file if it has not yet done so */ | |||
4422 | ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4422,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4423 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4423,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4424 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4424,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4425 | if (isbinary) { | |||
4426 | ierr = MatLoad_SeqAIJ_Binary(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4426,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4427 | } else if (ishdf5) { | |||
4428 | #if defined(PETSC_HAVE_HDF5) | |||
4429 | ierr = MatLoad_AIJ_HDF5(newMat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4429,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4430 | #else | |||
4431 | SETERRQ(PetscObjectComm((PetscObject)newMat),PETSC_ERR_SUP,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject)newMat),4431,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 56,PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5" ); | |||
4432 | #endif | |||
4433 | } else { | |||
4434 | SETERRQ2(PetscObjectComm((PetscObject)newMat),PETSC_ERR_SUP,"Viewer type %s not yet supported for reading %s matrices",((PetscObject)viewer)->type_name,((PetscObject)newMat)->type_name)do {if (__builtin_expect(!!(56),0)) {PetscError(((MPI_Comm)0x44000001 ),4434,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,56,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )newMat),56);}} while (0); | |||
4435 | } | |||
4436 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4437 | } | |||
4438 | ||||
4439 | PetscErrorCode MatLoad_SeqAIJ_Binary(Mat newMat, PetscViewer viewer) | |||
4440 | { | |||
4441 | Mat_SeqAIJ *a; | |||
4442 | PetscErrorCode ierr; | |||
4443 | PetscInt i,sum,nz,header[4],*rowlengths = 0,M,N,rows,cols; | |||
4444 | int fd; | |||
4445 | PetscMPIInt size; | |||
4446 | MPI_Comm comm; | |||
4447 | PetscInt bs = newMat->rmap->bs; | |||
4448 | ||||
4449 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4449; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4450 | ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4450,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4451 | ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4452 | if (size > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"view must have one processor")return PetscError(((MPI_Comm)0x44000001),4452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,60,PETSC_ERROR_INITIAL,"view must have one processor"); | |||
4453 | ||||
4454 | ierr = PetscOptionsBegin(comm,NULL,"Options for loading SEQAIJ matrix","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero (PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject ->count=(PetscOptionsPublish?-1:1); PetscOptionsObject-> count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscOptionsBegin_Private(PetscOptionsObject,comm,((void*) 0),"Options for loading SEQAIJ matrix","Mat");do {if (__builtin_expect (!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001),4454,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", _5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),_5_ierr);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4454,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4455 | ierr = PetscOptionsInt("-matload_block_size","Set the blocksize used to store the matrix","MatLoad",bs,&bs,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-matload_block_size" ,"Set the blocksize used to store the matrix","MatLoad",bs,& bs,((void*)0),(-2147483647 - 1),2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4455,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4456 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),4456,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),_5_ierr);}} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4456,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4457 | if (bs < 0) bs = 1; | |||
4458 | ierr = MatSetBlockSize(newMat,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4458,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4459 | ||||
4460 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4460,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4461 | ierr = PetscBinaryRead(fd,header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4461,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4462 | if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object in file")return PetscError(((MPI_Comm)0x44000001),4462,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,79,PETSC_ERROR_INITIAL,"not matrix object in file"); | |||
4463 | M = header[1]; N = header[2]; nz = header[3]; | |||
4464 | ||||
4465 | if (nz < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"Matrix stored in special format on disk,cannot load as SeqAIJ")return PetscError(((MPI_Comm)0x44000001),4465,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,79,PETSC_ERROR_INITIAL,"Matrix stored in special format on disk,cannot load as SeqAIJ" ); | |||
4466 | ||||
4467 | /* read in row lengths */ | |||
4468 | ierr = PetscMalloc1(M,&rowlengths)PetscMallocA(1,PETSC_FALSE,4468,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(M)*sizeof(**(&rowlengths)),(&rowlengths));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4468,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4469 | ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4469,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4470 | ||||
4471 | /* check if sum of rowlengths is same as nz */ | |||
4472 | for (i=0,sum=0; i< M; i++) sum +=rowlengths[i]; | |||
4473 | if (sum != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_FILE_READ,"Inconsistant matrix data in file. no-nonzeros = %dD, sum-row-lengths = %D\n",nz,sum)do {if (__builtin_expect(!!(66),0)) {PetscError(((MPI_Comm)0x44000001 ),4473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,66,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 66);}} while (0); | |||
4474 | ||||
4475 | /* set global size if not set already*/ | |||
4476 | if (newMat->rmap->n < 0 && newMat->rmap->N < 0 && newMat->cmap->n < 0 && newMat->cmap->N < 0) { | |||
4477 | ierr = MatSetSizes(newMat,PETSC_DECIDE-1,PETSC_DECIDE-1,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4478 | } else { | |||
4479 | /* if sizes and type are already set, check if the matrix global sizes are correct */ | |||
4480 | ierr = MatGetSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4480,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4481 | if (rows < 0 && cols < 0) { /* user might provide local size instead of global size */ | |||
4482 | ierr = MatGetLocalSize(newMat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4482,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4483 | } | |||
4484 | 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),4484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,79,PETSC_ERROR_INITIAL,"Matrix in file of different length (%D, %D) than the input matrix (%D, %D)" ,M,N,rows,cols); | |||
4485 | } | |||
4486 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(newMat,0,rowlengths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4486,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4487 | a = (Mat_SeqAIJ*)newMat->data; | |||
4488 | ||||
4489 | ierr = PetscBinaryRead(fd,a->j,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4490 | ||||
4491 | /* read in nonzero values */ | |||
4492 | ierr = PetscBinaryRead(fd,a->a,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4492,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4493 | ||||
4494 | /* set matrix "i" values */ | |||
4495 | a->i[0] = 0; | |||
4496 | for (i=1; i<= M; i++) { | |||
4497 | a->i[i] = a->i[i-1] + rowlengths[i-1]; | |||
4498 | a->ilen[i-1] = rowlengths[i-1]; | |||
4499 | } | |||
4500 | ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),4500,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((rowlengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4500,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4501 | ||||
4502 | ierr = MatAssemblyBegin(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4502,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4503 | ierr = MatAssemblyEnd(newMat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4503,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4504 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4505 | } | |||
4506 | ||||
4507 | PetscErrorCode MatEqual_SeqAIJ(Mat A,Mat B,PetscBool * flg) | |||
4508 | { | |||
4509 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data,*b = (Mat_SeqAIJ*)B->data; | |||
4510 | PetscErrorCode ierr; | |||
4511 | #if defined(PETSC_USE_COMPLEX) | |||
4512 | PetscInt k; | |||
4513 | #endif | |||
4514 | ||||
4515 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4515; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4516 | /* If the matrix dimensions are not equal,or no of nonzeros */ | |||
4517 | if ((A->rmap->n != B->rmap->n) || (A->cmap->n != B->cmap->n) ||(a->nz != b->nz)) { | |||
4518 | *flg = PETSC_FALSE; | |||
4519 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4520 | } | |||
4521 | ||||
4522 | /* if the a->i are the same */ | |||
4523 | ierr = PetscArraycmp(a->i,b->i,A->rmap->n+1,flg)((sizeof(*(a->i)) != sizeof(*(b->i))) || PetscMemcmp(a-> i,b->i,(A->rmap->n+1)*sizeof(*(a->i)),flg));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4523,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4524 | if (!*flg) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4525 | ||||
4526 | /* if a->j are the same */ | |||
4527 | ierr = PetscArraycmp(a->j,b->j,a->nz,flg)((sizeof(*(a->j)) != sizeof(*(b->j))) || PetscMemcmp(a-> j,b->j,(a->nz)*sizeof(*(a->j)),flg));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4527,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4528 | if (!*flg) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4529 | ||||
4530 | /* if a->a are the same */ | |||
4531 | #if defined(PETSC_USE_COMPLEX) | |||
4532 | for (k=0; k<a->nz; k++) { | |||
4533 | if (PetscRealPart(a->a[k])(a->a[k]) != PetscRealPart(b->a[k])(b->a[k]) || PetscImaginaryPart(a->a[k])((PetscReal)0.) != PetscImaginaryPart(b->a[k])((PetscReal)0.)) { | |||
4534 | *flg = PETSC_FALSE; | |||
4535 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4536 | } | |||
4537 | } | |||
4538 | #else | |||
4539 | ierr = PetscArraycmp(a->a,b->a,a->nz,flg)((sizeof(*(a->a)) != sizeof(*(b->a))) || PetscMemcmp(a-> a,b->a,(a->nz)*sizeof(*(a->a)),flg));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4539,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4540 | #endif | |||
4541 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4542 | } | |||
4543 | ||||
4544 | /*@ | |||
4545 | MatCreateSeqAIJWithArrays - Creates an sequential AIJ matrix using matrix elements (in CSR format) | |||
4546 | provided by the user. | |||
4547 | ||||
4548 | Collective | |||
4549 | ||||
4550 | Input Parameters: | |||
4551 | + comm - must be an MPI communicator of size 1 | |||
4552 | . m - number of rows | |||
4553 | . n - number of columns | |||
4554 | . i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of elements in that row of the matrix | |||
4555 | . j - column indices | |||
4556 | - a - matrix values | |||
4557 | ||||
4558 | Output Parameter: | |||
4559 | . mat - the matrix | |||
4560 | ||||
4561 | Level: intermediate | |||
4562 | ||||
4563 | Notes: | |||
4564 | The i, j, and a arrays are not copied by this routine, the user must free these arrays | |||
4565 | once the matrix is destroyed and not before | |||
4566 | ||||
4567 | You cannot set new nonzero locations into this matrix, that will generate an error. | |||
4568 | ||||
4569 | The i and j indices are 0 based | |||
4570 | ||||
4571 | The format which is used for the sparse matrix input, is equivalent to a | |||
4572 | row-major ordering.. i.e for the following matrix, the input data expected is | |||
4573 | as shown | |||
4574 | ||||
4575 | $ 1 0 0 | |||
4576 | $ 2 0 3 | |||
4577 | $ 4 5 6 | |||
4578 | $ | |||
4579 | $ i = {0,1,3,6} [size = nrow+1 = 3+1] | |||
4580 | $ j = {0,0,2,0,1,2} [size = 6]; values must be sorted for each row | |||
4581 | $ v = {1,2,3,4,5,6} [size = 6] | |||
4582 | ||||
4583 | ||||
4584 | .seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateMPIAIJWithArrays(), MatMPIAIJSetPreallocationCSR() | |||
4585 | ||||
4586 | @*/ | |||
4587 | PetscErrorCode MatCreateSeqAIJWithArrays(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat) | |||
4588 | { | |||
4589 | PetscErrorCode ierr; | |||
4590 | PetscInt ii; | |||
4591 | Mat_SeqAIJ *aij; | |||
4592 | #if defined(PETSC_USE_DEBUG1) | |||
4593 | PetscInt jj; | |||
4594 | #endif | |||
4595 | ||||
4596 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4596; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4597 | 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),4597,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0"); | |||
4598 | ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4599 | ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4599,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4600 | /* ierr = MatSetBlockSizes(*mat,,);CHKERRQ(ierr); */ | |||
4601 | ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4601,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4602 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,MAT_SKIP_ALLOCATION-4,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4602,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4603 | aij = (Mat_SeqAIJ*)(*mat)->data; | |||
4604 | ierr = PetscMalloc1(m,&aij->imax)PetscMallocA(1,PETSC_FALSE,4604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m)*sizeof(**(&aij->imax)),(&aij->imax ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4605 | ierr = PetscMalloc1(m,&aij->ilen)PetscMallocA(1,PETSC_FALSE,4605,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m)*sizeof(**(&aij->ilen)),(&aij->ilen ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4605,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4606 | ||||
4607 | aij->i = i; | |||
4608 | aij->j = j; | |||
4609 | aij->a = a; | |||
4610 | aij->singlemalloc = PETSC_FALSE; | |||
4611 | aij->nonew = -1; /*this indicates that inserting a new value in the matrix that generates a new nonzero is an error*/ | |||
4612 | aij->free_a = PETSC_FALSE; | |||
4613 | aij->free_ij = PETSC_FALSE; | |||
4614 | ||||
4615 | for (ii=0; ii<m; ii++) { | |||
4616 | aij->ilen[ii] = aij->imax[ii] = i[ii+1] - i[ii]; | |||
4617 | #if defined(PETSC_USE_DEBUG1) | |||
4618 | if (i[ii+1] - i[ii] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row length in i (row indices) row = %D length = %D",ii,i[ii+1] - i[ii])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),4618,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
4619 | for (jj=i[ii]+1; jj<i[ii+1]; jj++) { | |||
4620 | if (j[jj] < j[jj-1]) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column entry number %D (actual column %D) in row %D is not sorted",jj-i[ii],j[jj],ii)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),4620,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
4621 | if (j[jj] == j[jj-1]) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column entry number %D (actual column %D) in row %D is identical to previous entry",jj-i[ii],j[jj],ii)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),4621,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
4622 | } | |||
4623 | #endif | |||
4624 | } | |||
4625 | #if defined(PETSC_USE_DEBUG1) | |||
4626 | for (ii=0; ii<aij->i[m]; ii++) { | |||
4627 | if (j[ii] < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column index at location = %D index = %D",ii,j[ii])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),4627,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
4628 | if (j[ii] > n - 1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column index to large at location = %D index = %D",ii,j[ii])do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),4628,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
4629 | } | |||
4630 | #endif | |||
4631 | ||||
4632 | ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4633 | ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4633,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4634 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4635 | } | |||
4636 | /*@C | |||
4637 | MatCreateSeqAIJFromTriple - Creates an sequential AIJ matrix using matrix elements (in COO format) | |||
4638 | provided by the user. | |||
4639 | ||||
4640 | Collective | |||
4641 | ||||
4642 | Input Parameters: | |||
4643 | + comm - must be an MPI communicator of size 1 | |||
4644 | . m - number of rows | |||
4645 | . n - number of columns | |||
4646 | . i - row indices | |||
4647 | . j - column indices | |||
4648 | . a - matrix values | |||
4649 | . nz - number of nonzeros | |||
4650 | - idx - 0 or 1 based | |||
4651 | ||||
4652 | Output Parameter: | |||
4653 | . mat - the matrix | |||
4654 | ||||
4655 | Level: intermediate | |||
4656 | ||||
4657 | Notes: | |||
4658 | The i and j indices are 0 based | |||
4659 | ||||
4660 | The format which is used for the sparse matrix input, is equivalent to a | |||
4661 | row-major ordering.. i.e for the following matrix, the input data expected is | |||
4662 | as shown: | |||
4663 | ||||
4664 | 1 0 0 | |||
4665 | 2 0 3 | |||
4666 | 4 5 6 | |||
4667 | ||||
4668 | i = {0,1,1,2,2,2} | |||
4669 | j = {0,0,2,0,1,2} | |||
4670 | v = {1,2,3,4,5,6} | |||
4671 | ||||
4672 | ||||
4673 | .seealso: MatCreate(), MatCreateAIJ(), MatCreateSeqAIJ(), MatCreateSeqAIJWithArrays(), MatMPIAIJSetPreallocationCSR() | |||
4674 | ||||
4675 | @*/ | |||
4676 | PetscErrorCode MatCreateSeqAIJFromTriple(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt i[],PetscInt j[],PetscScalar a[],Mat *mat,PetscInt nz,PetscBool idx) | |||
4677 | { | |||
4678 | PetscErrorCode ierr; | |||
4679 | PetscInt ii, *nnz, one = 1,row,col; | |||
4680 | ||||
4681 | ||||
4682 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4682; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4683 | ierr = PetscCalloc1(m,&nnz)PetscMallocA(1,PETSC_TRUE,4683,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(m)*sizeof(**(&nnz)),(&nnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4683,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4684 | for (ii = 0; ii < nz; ii++) { | |||
4685 | nnz[i[ii] - !!idx] += 1; | |||
4686 | } | |||
4687 | ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4687,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4688 | ierr = MatSetSizes(*mat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4689 | ierr = MatSetType(*mat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4689,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4690 | ierr = MatSeqAIJSetPreallocation_SeqAIJ(*mat,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4691 | for (ii = 0; ii < nz; ii++) { | |||
4692 | if (idx) { | |||
4693 | row = i[ii] - 1; | |||
4694 | col = j[ii] - 1; | |||
4695 | } else { | |||
4696 | row = i[ii]; | |||
4697 | col = j[ii]; | |||
4698 | } | |||
4699 | ierr = MatSetValues(*mat,one,&row,one,&col,&a[ii],ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4700 | } | |||
4701 | ierr = MatAssemblyBegin(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4702 | ierr = MatAssemblyEnd(*mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4703 | ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),4703,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((nnz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4703,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4704 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4705 | } | |||
4706 | ||||
4707 | PetscErrorCode MatSeqAIJInvalidateDiagonal(Mat A) | |||
4708 | { | |||
4709 | Mat_SeqAIJ *a=(Mat_SeqAIJ*)A->data; | |||
4710 | PetscErrorCode ierr; | |||
4711 | ||||
4712 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4712; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4713 | a->idiagvalid = PETSC_FALSE; | |||
4714 | a->ibdiagvalid = PETSC_FALSE; | |||
4715 | ||||
4716 | ierr = MatSeqAIJInvalidateDiagonal_Inode(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4716,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4717 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4718 | } | |||
4719 | ||||
4720 | PetscErrorCode MatCreateMPIMatConcatenateSeqMat_SeqAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat) | |||
4721 | { | |||
4722 | PetscErrorCode ierr; | |||
4723 | PetscMPIInt size; | |||
4724 | ||||
4725 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4725; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4726 | ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4726,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4727 | if (size == 1) { | |||
4728 | if (scall == MAT_INITIAL_MATRIX) { | |||
4729 | ierr = MatDuplicate(inmat,MAT_COPY_VALUES,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4729,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4730 | } else { | |||
4731 | ierr = MatCopy(inmat,*outmat,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4731,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4732 | } | |||
4733 | } else { | |||
4734 | ierr = MatCreateMPIMatConcatenateSeqMat_MPIAIJ(comm,inmat,n,scall,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4735 | } | |||
4736 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4737 | } | |||
4738 | ||||
4739 | /* | |||
4740 | Permute A into C's *local* index space using rowemb,colemb. | |||
4741 | The embedding are supposed to be injections and the above implies that the range of rowemb is a subset | |||
4742 | of [0,m), colemb is in [0,n). | |||
4743 | If pattern == DIFFERENT_NONZERO_PATTERN, C is preallocated according to A. | |||
4744 | */ | |||
4745 | PetscErrorCode MatSetSeqMat_SeqAIJ(Mat C,IS rowemb,IS colemb,MatStructure pattern,Mat B) | |||
4746 | { | |||
4747 | /* If making this function public, change the error returned in this function away from _PLIB. */ | |||
4748 | PetscErrorCode ierr; | |||
4749 | Mat_SeqAIJ *Baij; | |||
4750 | PetscBool seqaij; | |||
4751 | PetscInt m,n,*nz,i,j,count; | |||
4752 | PetscScalar v; | |||
4753 | const PetscInt *rowindices,*colindices; | |||
4754 | ||||
4755 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4755; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4756 | if (!B) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4757 | /* Check to make sure the target matrix (and embeddings) are compatible with C and each other. */ | |||
4758 | ierr = PetscObjectBaseTypeCompare((PetscObject)B,MATSEQAIJ"seqaij",&seqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4758,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4759 | if (!seqaij) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is of wrong type")return PetscError(((MPI_Comm)0x44000001),4759,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,77,PETSC_ERROR_INITIAL,"Input matrix is of wrong type"); | |||
4760 | if (rowemb) { | |||
4761 | ierr = ISGetLocalSize(rowemb,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4761,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4762 | if (m != B->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Row IS of size %D is incompatible with matrix row size %D",m,B->rmap->n)do {if (__builtin_expect(!!(77),0)) {PetscError(((MPI_Comm)0x44000001 ),4762,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 77);}} while (0); | |||
4763 | } else { | |||
4764 | if (C->rmap->n != B->rmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is row-incompatible with the target matrix")return PetscError(((MPI_Comm)0x44000001),4764,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,77,PETSC_ERROR_INITIAL,"Input matrix is row-incompatible with the target matrix" ); | |||
4765 | } | |||
4766 | if (colemb) { | |||
4767 | ierr = ISGetLocalSize(colemb,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4767,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4768 | if (n != B->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Diag col IS of size %D is incompatible with input matrix col size %D",n,B->cmap->n)do {if (__builtin_expect(!!(77),0)) {PetscError(((MPI_Comm)0x44000001 ),4768,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,77,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 77);}} while (0); | |||
4769 | } else { | |||
4770 | if (C->cmap->n != B->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Input matrix is col-incompatible with the target matrix")return PetscError(((MPI_Comm)0x44000001),4770,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,77,PETSC_ERROR_INITIAL,"Input matrix is col-incompatible with the target matrix" ); | |||
4771 | } | |||
4772 | ||||
4773 | Baij = (Mat_SeqAIJ*)(B->data); | |||
4774 | if (pattern == DIFFERENT_NONZERO_PATTERN) { | |||
4775 | ierr = PetscMalloc1(B->rmap->n,&nz)PetscMallocA(1,PETSC_FALSE,4775,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,(size_t)(B->rmap->n)*sizeof(**(&nz)),(&nz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4775,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4776 | for (i=0; i<B->rmap->n; i++) { | |||
4777 | nz[i] = Baij->i[i+1] - Baij->i[i]; | |||
4778 | } | |||
4779 | ierr = MatSeqAIJSetPreallocation(C,0,nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4779,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4780 | ierr = PetscFree(nz)((*PetscTrFree)((void*)(nz),4780,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ) || ((nz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4780,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4781 | } | |||
4782 | if (pattern == SUBSET_NONZERO_PATTERN) { | |||
4783 | ierr = MatZeroEntries(C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4783,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4784 | } | |||
4785 | count = 0; | |||
4786 | rowindices = NULL((void*)0); | |||
4787 | colindices = NULL((void*)0); | |||
4788 | if (rowemb) { | |||
4789 | ierr = ISGetIndices(rowemb,&rowindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4789,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4790 | } | |||
4791 | if (colemb) { | |||
4792 | ierr = ISGetIndices(colemb,&colindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4793 | } | |||
4794 | for (i=0; i<B->rmap->n; i++) { | |||
4795 | PetscInt row; | |||
4796 | row = i; | |||
4797 | if (rowindices) row = rowindices[i]; | |||
4798 | for (j=Baij->i[i]; j<Baij->i[i+1]; j++) { | |||
4799 | PetscInt col; | |||
4800 | col = Baij->j[count]; | |||
4801 | if (colindices) col = colindices[col]; | |||
4802 | v = Baij->a[count]; | |||
4803 | ierr = MatSetValues(C,1,&row,1,&col,&v,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4804 | ++count; | |||
4805 | } | |||
4806 | } | |||
4807 | /* FIXME: set C's nonzerostate correctly. */ | |||
4808 | /* Assembly for C is necessary. */ | |||
4809 | C->preallocated = PETSC_TRUE; | |||
4810 | C->assembled = PETSC_TRUE; | |||
4811 | C->was_assembled = PETSC_FALSE; | |||
4812 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4813 | } | |||
4814 | ||||
4815 | PetscFunctionList MatSeqAIJList = NULL((void*)0); | |||
4816 | ||||
4817 | /*@C | |||
4818 | MatSeqAIJSetType - Converts a MATSEQAIJ matrix to a subtype | |||
4819 | ||||
4820 | Collective on Mat | |||
4821 | ||||
4822 | Input Parameters: | |||
4823 | + mat - the matrix object | |||
4824 | - matype - matrix type | |||
4825 | ||||
4826 | Options Database Key: | |||
4827 | . -mat_seqai_type <method> - for example seqaijcrl | |||
4828 | ||||
4829 | ||||
4830 | Level: intermediate | |||
4831 | ||||
4832 | .seealso: PCSetType(), VecSetType(), MatCreate(), MatType, Mat | |||
4833 | @*/ | |||
4834 | PetscErrorCode MatSeqAIJSetType(Mat mat, MatType matype) | |||
4835 | { | |||
4836 | PetscErrorCode ierr,(*r)(Mat,MatType,MatReuse,Mat*); | |||
4837 | PetscBool sametype; | |||
4838 | ||||
4839 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4839; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4840 | PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),4840, __func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),4840,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if (((PetscObject)(mat))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),4840,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),4840,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", 62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
4841 | ierr = PetscObjectTypeCompare((PetscObject)mat,matype,&sametype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4841,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4842 | if (sametype) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4843 | ||||
4844 | ierr = PetscFunctionListFind(MatSeqAIJList,matype,&r)PetscFunctionListFind_Private((MatSeqAIJList),(matype),(PetscVoidFunction *)(&r));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4844,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4845 | if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE,"Unknown Mat type given: %s",matype)return PetscError(((MPI_Comm)0x44000001),4845,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,86,PETSC_ERROR_INITIAL,"Unknown Mat type given: %s",matype); | |||
4846 | ierr = (*r)(mat,matype,MAT_INPLACE_MATRIX,&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4846,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4847 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4848 | } | |||
4849 | ||||
4850 | ||||
4851 | /*@C | |||
4852 | MatSeqAIJRegister - - Adds a new sub-matrix type for sequential AIJ matrices | |||
4853 | ||||
4854 | Not Collective | |||
4855 | ||||
4856 | Input Parameters: | |||
4857 | + name - name of a new user-defined matrix type, for example MATSEQAIJCRL | |||
4858 | - function - routine to convert to subtype | |||
4859 | ||||
4860 | Notes: | |||
4861 | MatSeqAIJRegister() may be called multiple times to add several user-defined solvers. | |||
4862 | ||||
4863 | ||||
4864 | Then, your matrix can be chosen with the procedural interface at runtime via the option | |||
4865 | $ -mat_seqaij_type my_mat | |||
4866 | ||||
4867 | Level: advanced | |||
4868 | ||||
4869 | .seealso: MatSeqAIJRegisterAll() | |||
4870 | ||||
4871 | ||||
4872 | Level: advanced | |||
4873 | @*/ | |||
4874 | PetscErrorCode MatSeqAIJRegister(const char sname[],PetscErrorCode (*function)(Mat,MatType,MatReuse,Mat *)) | |||
4875 | { | |||
4876 | PetscErrorCode ierr; | |||
4877 | ||||
4878 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4878; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4879 | ierr = MatInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4879,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4880 | ierr = PetscFunctionListAdd(&MatSeqAIJList,sname,function)PetscFunctionListAdd_Private((&MatSeqAIJList),(sname),(PetscVoidFunction )(function));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4880,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4881 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4882 | } | |||
4883 | ||||
4884 | PetscBool MatSeqAIJRegisterAllCalled = PETSC_FALSE; | |||
4885 | ||||
4886 | /*@C | |||
4887 | MatSeqAIJRegisterAll - Registers all of the matrix subtypes of SeqAIJ | |||
4888 | ||||
4889 | Not Collective | |||
4890 | ||||
4891 | Level: advanced | |||
4892 | ||||
4893 | Developers Note: CUSP and CUSPARSE do not yet support the MatConvert_SeqAIJ..() paradigm and thus cannot be registered here | |||
4894 | ||||
4895 | .seealso: MatRegisterAll(), MatSeqAIJRegister() | |||
4896 | @*/ | |||
4897 | PetscErrorCode MatSeqAIJRegisterAll(void) | |||
4898 | { | |||
4899 | PetscErrorCode ierr; | |||
4900 | ||||
4901 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4901; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4902 | if (MatSeqAIJRegisterAllCalled) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4903 | MatSeqAIJRegisterAllCalled = PETSC_TRUE; | |||
4904 | ||||
4905 | ierr = MatSeqAIJRegister(MATSEQAIJCRL"seqaijcrl", MatConvert_SeqAIJ_SeqAIJCRL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4906 | ierr = MatSeqAIJRegister(MATSEQAIJPERM"seqaijperm", MatConvert_SeqAIJ_SeqAIJPERM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4907 | ierr = MatSeqAIJRegister(MATSEQAIJSELL"seqaijsell", MatConvert_SeqAIJ_SeqAIJSELL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4907,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4908 | #if defined(PETSC_HAVE_MKL_SPARSE) | |||
4909 | ierr = MatSeqAIJRegister(MATSEQAIJMKL"seqaijmkl", MatConvert_SeqAIJ_SeqAIJMKL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4909,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4910 | #endif | |||
4911 | #if defined(PETSC_HAVE_VIENNACL) && defined(PETSC_HAVE_VIENNACL_NO_CUDA) | |||
4912 | ierr = MatSeqAIJRegister(MATMPIAIJVIENNACL"mpiaijviennacl", MatConvert_SeqAIJ_SeqAIJViennaCL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
4913 | #endif | |||
4914 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
4915 | } | |||
4916 | ||||
4917 | /* | |||
4918 | Special version for direct calls from Fortran | |||
4919 | */ | |||
4920 | #include <petsc/private/fortranimpl.h> | |||
4921 | #if defined(PETSC_HAVE_FORTRAN_CAPS) | |||
4922 | #define matsetvaluesseqaij_ MATSETVALUESSEQAIJ | |||
4923 | #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE1) | |||
4924 | #define matsetvaluesseqaij_ matsetvaluesseqaij | |||
4925 | #endif | |||
4926 | ||||
4927 | /* Change these macros so can be used in void function */ | |||
4928 | #undef CHKERRQ | |||
4929 | #define CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4929,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0) CHKERRABORT(PetscObjectComm((PetscObject)A),ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4929,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0) | |||
4930 | #undef SETERRQ2 | |||
4931 | #define SETERRQ2(comm,ierr,b,c,d)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4931,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while ( 0) CHKERRABORT(comm,ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4931,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while ( 0) | |||
4932 | #undef SETERRQ3 | |||
4933 | #define SETERRQ3(comm,ierr,b,c,d,e)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while ( 0) CHKERRABORT(comm,ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),4933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(comm,ierr);}} while ( 0) | |||
4934 | ||||
4935 | PETSC_EXTERNextern __attribute__((visibility ("default"))) void PETSC_STDCALL matsetvaluesseqaij_(Mat *AA,PetscInt *mm,const PetscInt im[],PetscInt *nn,const PetscInt in[],const PetscScalar v[],InsertMode *isis, PetscErrorCode *_ierr) | |||
4936 | { | |||
4937 | Mat A = *AA; | |||
4938 | PetscInt m = *mm, n = *nn; | |||
4939 | InsertMode is = *isis; | |||
4940 | Mat_SeqAIJ *a = (Mat_SeqAIJ*)A->data; | |||
4941 | PetscInt *rp,k,low,high,t,ii,row,nrow,i,col,l,rmax,N; | |||
4942 | PetscInt *imax,*ai,*ailen; | |||
4943 | PetscErrorCode ierr; | |||
4944 | PetscInt *aj,nonew = a->nonew,lastcol = -1; | |||
4945 | MatScalar *ap,value,*aa; | |||
4946 | PetscBool ignorezeroentries = a->ignorezeroentries; | |||
4947 | PetscBool roworiented = a->roworiented; | |||
4948 | ||||
4949 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ; petscstack->line[petscstack->currentsize] = 4949; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
4950 | MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) do {if (__builtin_expect(!!(73),0)) {PetscError(((MPI_Comm)0x44000001 ),4950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,73,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 73);}} while (0); } while (0); | |||
4951 | imax = a->imax; | |||
4952 | ai = a->i; | |||
4953 | ailen = a->ilen; | |||
4954 | aj = a->j; | |||
4955 | aa = a->a; | |||
4956 | ||||
4957 | for (k=0; k<m; k++) { /* loop over added rows */ | |||
4958 | row = im[k]; | |||
4959 | if (row < 0) continue; | |||
4960 | #if defined(PETSC_USE_DEBUG1) | |||
4961 | if (row >= A->rmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Row too large")do {PetscError(PetscObjectComm((PetscObject)A),4961,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63 ,PETSC_ERROR_INITIAL,"Row too large");MPI_Abort(PetscObjectComm ((PetscObject)A),63);} while (0); | |||
4962 | #endif | |||
4963 | rp = aj + ai[row]; ap = aa + ai[row]; | |||
4964 | rmax = imax[row]; nrow = ailen[row]; | |||
4965 | low = 0; | |||
4966 | high = nrow; | |||
4967 | for (l=0; l<n; l++) { /* loop over added columns */ | |||
4968 | if (in[l] < 0) continue; | |||
4969 | #if defined(PETSC_USE_DEBUG1) | |||
4970 | if (in[l] >= A->cmap->n) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Column too large")do {PetscError(PetscObjectComm((PetscObject)A),4970,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63 ,PETSC_ERROR_INITIAL,"Column too large");MPI_Abort(PetscObjectComm ((PetscObject)A),63);} while (0); | |||
4971 | #endif | |||
4972 | col = in[l]; | |||
4973 | if (roworiented) value = v[l + k*n]; | |||
4974 | else value = v[k + l*m]; | |||
4975 | ||||
4976 | if (value == 0.0 && ignorezeroentries && (is == ADD_VALUES)) continue; | |||
4977 | ||||
4978 | if (col <= lastcol) low = 0; | |||
4979 | else high = nrow; | |||
4980 | lastcol = col; | |||
4981 | while (high-low > 5) { | |||
4982 | t = (low+high)/2; | |||
4983 | if (rp[t] > col) high = t; | |||
4984 | else low = t; | |||
4985 | } | |||
4986 | for (i=low; i<high; i++) { | |||
4987 | if (rp[i] > col) break; | |||
4988 | if (rp[i] == col) { | |||
4989 | if (is == ADD_VALUES) ap[i] += value; | |||
4990 | else ap[i] = value; | |||
4991 | goto noinsert; | |||
4992 | } | |||
4993 | } | |||
4994 | if (value == 0.0 && ignorezeroentries) goto noinsert; | |||
4995 | if (nonew == 1) goto noinsert; | |||
4996 | if (nonew == -1) SETERRABORT(PetscObjectComm((PetscObject)A),PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero in the matrix")do {PetscError(PetscObjectComm((PetscObject)A),4996,__func__, "/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c",63 ,PETSC_ERROR_INITIAL,"Inserting a new nonzero in the matrix") ;MPI_Abort(PetscObjectComm((PetscObject)A),63);} while (0); | |||
4997 | MatSeqXAIJReallocateAIJ(A,A->rmap->n,1,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[A->rmap->n] + CHUNKSIZE ,len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),4997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); ierr = PetscMallocA(3,PETSC_FALSE,4997,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", (size_t)(1*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(A-> rmap->n+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),4997,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); for (ii=0; ii<row+1; ii++) {new_i[ ii] = ai[ii];} for (ii=row+1; ii<A->rmap->n+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof (*(new_j))));do {if (__builtin_expect(!!(ierr),0)) {PetscError (((MPI_Comm)0x44000001),4997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); len = (new_nz - CHUNKSIZE - ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE)) != sizeof (*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE ,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE) )));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm )0x44000001),4997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = ((sizeof(*(new_a)) != sizeof(* (aa))) || PetscMemcpy(new_a,aa,(1*(ai[row]+nrow))*sizeof(*(new_a ))));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm )0x44000001),4997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = PetscMemzero(new_a+1*(ai[row]+ nrow),(1*CHUNKSIZE)*sizeof(*(new_a+1*(ai[row]+nrow))));do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001 ),4997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = ((sizeof(*(new_a+1*(ai[row]+nrow +CHUNKSIZE))) != sizeof(*(aa+1*(ai[row]+nrow)))) || PetscMemcpy (new_a+1*(ai[row]+nrow+CHUNKSIZE),aa+1*(ai[row]+nrow),(1*len) *sizeof(*(new_a+1*(ai[row]+nrow+CHUNKSIZE)))));do {if (__builtin_expect (!!(ierr),0)) {PetscError(((MPI_Comm)0x44000001),4997,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c", ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); ierr = MatSeqXAIJFreeAIJ(A,&Ain-> a,&Ain->j,&Ain->i);do {if (__builtin_expect(!!( ierr),0)) {PetscError(((MPI_Comm)0x44000001),4997,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/aij/seq/aij.c" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); aa = new_a; Ain->a = (MatScalar*) new_a ; ai = Ain->i = new_i; aj = Ain->j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row]; ap = aa + 1*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE; Ain->maxnz += 1*CHUNKSIZE ; Ain->reallocs++; }; | |||
4998 | N = nrow++ - 1; a->nz++; high++; | |||
4999 | /* shift up all the later entries in this row */ | |||
5000 | for (ii=N; ii>=i; ii--) { | |||
5001 | rp[ii+1] = rp[ii]; | |||
5002 | ap[ii+1] = ap[ii]; | |||
5003 | } | |||
5004 | rp[i] = col; | |||
5005 | ap[i] = value; | |||
5006 | A->nonzerostate++; | |||
5007 | noinsert:; | |||
5008 | low = i + 1; | |||
5009 | } | |||
5010 | ailen[row] = nrow; | |||
5011 | } | |||
5012 | 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); | |||
5013 | } |
1 | #ifndef PETSCCTABLE_H | |||
2 | #define PETSCCTABLE_H | |||
3 | #include <petscsys.h> | |||
4 | ||||
5 | struct _n_PetscTable { | |||
6 | PetscInt *keytable; | |||
7 | PetscInt *table; | |||
8 | PetscInt count; | |||
9 | PetscInt tablesize; | |||
10 | PetscInt head; | |||
11 | PetscInt maxkey; /* largest key allowed */ | |||
12 | }; | |||
13 | ||||
14 | typedef struct _n_PetscTable* PetscTable; | |||
15 | typedef PetscInt* PetscTablePosition; | |||
16 | ||||
17 | PETSC_STATIC_INLINEstatic inline unsigned long PetscHash(PetscTable ta,unsigned long x) | |||
18 | { | |||
19 | return(x%(unsigned long)ta->tablesize); | |||
20 | } | |||
21 | ||||
22 | PETSC_STATIC_INLINEstatic inline unsigned long PetscHashStep(PetscTable ta,unsigned long x) | |||
23 | { | |||
24 | return(1+(x%(unsigned long)(ta->tablesize-1))); | |||
| ||||
25 | } | |||
26 | ||||
27 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreate(const PetscInt,PetscInt,PetscTable*); | |||
28 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreateCopy(const PetscTable,PetscTable*); | |||
29 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableDestroy(PetscTable*); | |||
30 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetCount(const PetscTable,PetscInt*); | |||
31 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableIsEmpty(const PetscTable,PetscInt*); | |||
32 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddExpand(PetscTable,PetscInt,PetscInt,InsertMode); | |||
33 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddCountExpand(PetscTable,PetscInt); | |||
34 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetHeadPosition(PetscTable,PetscTablePosition*); | |||
35 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetNext(PetscTable,PetscTablePosition*,PetscInt*,PetscInt*); | |||
36 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableRemoveAll(PetscTable); | |||
37 | ||||
38 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableAdd(PetscTable ta,PetscInt key,PetscInt data,InsertMode imode) | |||
39 | { | |||
40 | PetscErrorCode ierr; | |||
41 | PetscInt i,hash = (PetscInt)PetscHash(ta,(unsigned long)key); | |||
42 | PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key); | |||
43 | ||||
44 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscctable.h"; petscstack ->line[petscstack->currentsize] = 44; petscstack->petscroutine [petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize ++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
45 | if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key <= 0")return PetscError(((MPI_Comm)0x44000001),45,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"key <= 0"); | |||
46 | if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),46,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
47 | if (!data) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Null data")return PetscError(((MPI_Comm)0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"Null data"); | |||
48 | ||||
49 | for (i=0; i<ta->tablesize; i++) { | |||
50 | if (ta->keytable[hash] == key) { | |||
51 | switch (imode) { | |||
52 | case INSERT_VALUES: | |||
53 | ta->table[hash] = data; /* over write */ | |||
54 | break; | |||
55 | case ADD_VALUES: | |||
56 | ta->table[hash] += data; | |||
57 | break; | |||
58 | case MAX_VALUES: | |||
59 | ta->table[hash] = PetscMax(ta->table[hash],data)(((ta->table[hash])<(data)) ? (data) : (ta->table[hash ])); | |||
60 | break; | |||
61 | case NOT_SET_VALUES: | |||
62 | case INSERT_ALL_VALUES: | |||
63 | case ADD_ALL_VALUES: | |||
64 | case INSERT_BC_VALUES: | |||
65 | case ADD_BC_VALUES: | |||
66 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported InsertMode")return PetscError(((MPI_Comm)0x44000001),66,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,56,PETSC_ERROR_INITIAL,"Unsupported InsertMode"); | |||
67 | } | |||
68 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
69 | } else if (!ta->keytable[hash]) { | |||
70 | if (ta->count < 5*(ta->tablesize/6) - 1) { | |||
71 | ta->count++; /* add */ | |||
72 | ta->keytable[hash] = key; | |||
73 | ta->table[hash] = data; | |||
74 | } else { | |||
75 | ierr = PetscTableAddExpand(ta,key,data,imode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
76 | } | |||
77 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
78 | } | |||
79 | hash = (hash + hashstep)%ta->tablesize; | |||
80 | } | |||
81 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_COR,"Full table")return PetscError(((MPI_Comm)0x44000001),81,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,74,PETSC_ERROR_INITIAL,"Full table"); | |||
82 | /* PetscFunctionReturn(0); */ | |||
83 | } | |||
84 | ||||
85 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableAddCount(PetscTable ta,PetscInt key) | |||
86 | { | |||
87 | PetscErrorCode ierr; | |||
88 | PetscInt i,hash = (PetscInt)PetscHash(ta,(unsigned long)key); | |||
89 | PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key); | |||
90 | ||||
91 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscctable.h"; petscstack ->line[petscstack->currentsize] = 91; petscstack->petscroutine [petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize ++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
92 | if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key <= 0")return PetscError(((MPI_Comm)0x44000001),92,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"key <= 0"); | |||
93 | if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),93,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
94 | ||||
95 | for (i=0; i<ta->tablesize; i++) { | |||
96 | if (ta->keytable[hash] == key) { | |||
97 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
98 | } else if (!ta->keytable[hash]) { | |||
99 | if (ta->count < 5*(ta->tablesize/6) - 1) { | |||
100 | ta->count++; /* add */ | |||
101 | ta->keytable[hash] = key; | |||
102 | ta->table[hash] = ta->count; | |||
103 | } else { | |||
104 | ierr = PetscTableAddCountExpand(ta,key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) {PetscError(((MPI_Comm) 0x44000001),104,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,ierr,PETSC_ERROR_REPEAT," ");MPI_Abort(PetscObjectComm((PetscObject )A),ierr);}} while (0); | |||
105 | } | |||
106 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
107 | } | |||
108 | hash = (hash + hashstep)%ta->tablesize; | |||
109 | } | |||
110 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_COR,"Full table")return PetscError(((MPI_Comm)0x44000001),110,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,74,PETSC_ERROR_INITIAL,"Full table"); | |||
111 | /* PetscFunctionReturn(0); */ | |||
112 | } | |||
113 | ||||
114 | /* | |||
115 | PetscTableFind - checks if a key is in the table | |||
116 | ||||
117 | If data==0, then no table entry exists. | |||
118 | ||||
119 | */ | |||
120 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableFind(PetscTable ta,PetscInt key,PetscInt *data) | |||
121 | { | |||
122 | PetscInt ii = 0; | |||
123 | PetscInt hash = (PetscInt)PetscHash(ta,(unsigned long)key); | |||
124 | PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key); | |||
125 | ||||
126 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscctable.h"; petscstack ->line[petscstack->currentsize] = 126; petscstack->petscroutine [petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize ++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
127 | *data = 0; | |||
128 | if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Key <= 0")return PetscError(((MPI_Comm)0x44000001),128,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"Key <= 0"); | |||
129 | if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)do {if (__builtin_expect(!!(63),0)) {PetscError(((MPI_Comm)0x44000001 ),129,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_REPEAT," ");MPI_Abort(((MPI_Comm)0x44000001), 63);}} while (0); | |||
130 | ||||
131 | while (ii++ < ta->tablesize) { | |||
132 | if (!ta->keytable[hash]) break; | |||
133 | else if (ta->keytable[hash] == key) { | |||
134 | *data = ta->table[hash]; | |||
135 | break; | |||
136 | } | |||
137 | hash = (hash + hashstep)%ta->tablesize; | |||
138 | } | |||
139 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
140 | } | |||
141 | ||||
142 | #endif |