Bug Summary

File:mat/impls/sbaij/mpi/mmsbaij.c
Warning:line 24, column 14
Division by zero

Annotated Source Code

[?] Use j/k keys for keyboard navigation

/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c

1
2/*
3 Support for the parallel SBAIJ matrix vector multiply
4*/
5#include <../src/mat/impls/sbaij/mpi/mpisbaij.h>
6
7PetscErrorCode MatSetUpMultiply_MPISBAIJ(Mat mat)
8{
9 Mat_MPISBAIJ *sbaij = (Mat_MPISBAIJ*)mat->data;
10 Mat_SeqBAIJ *B = (Mat_SeqBAIJ*)(sbaij->B->data);
11 PetscErrorCode ierr;
12 PetscInt Nbs = sbaij->Nbs,i,j,*indices,*aj = B->j,ec = 0,*garray,*sgarray;
13 PetscInt bs = mat->rmap->bs,*stmp,mbs=sbaij->mbs, vec_size,nt;
14 IS from,to;
15 Vec gvec;
16 PetscMPIInt rank =sbaij->rank,lsize,size=sbaij->size;
17 PetscInt *owners=sbaij->rangebs,*ec_owner,k;
18 const PetscInt *sowners;
19 PetscScalar *ptr;
20
21 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
; petscstack->line[petscstack->currentsize] = 21; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
22 ierr = VecScatterDestroy(&sbaij->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),22,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
23
24 /* For the first stab we make an array as long as the number of columns */
25 /* mark those columns that are in sbaij->B */
26 ierr = PetscCalloc1(Nbs,&indices)PetscMallocA(1,PETSC_TRUE,26,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(Nbs)*sizeof(**(&indices)),(&indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),26,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
27 for (i=0; i<mbs; i++) {
28 for (j=0; j<B->ilen[i]; j++) {
29 if (!indices[aj[B->i[i] + j]]) ec++;
30 indices[aj[B->i[i] + j]] = 1;
31 }
32 }
33
34 /* form arrays of columns we need */
35 ierr = PetscMalloc1(ec,&garray)PetscMallocA(1,PETSC_FALSE,35,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(ec)*sizeof(**(&garray)),(&garray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),35,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
36 ierr = PetscMalloc2(2*ec,&sgarray,ec,&ec_owner)PetscMallocA(2,PETSC_FALSE,36,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(2*ec)*sizeof(**(&sgarray)),(&sgarray),(size_t
)(ec)*sizeof(**(&ec_owner)),(&ec_owner))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),36,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
37
38 ec = 0;
39 for (j=0; j<size; j++) {
40 for (i=owners[j]; i<owners[j+1]; i++) {
41 if (indices[i]) {
42 garray[ec] = i;
43 ec_owner[ec] = j;
44 ec++;
45 }
46 }
47 }
48
49 /* make indices now point into garray */
50 for (i=0; i<ec; i++) indices[garray[i]] = i;
51
52 /* compact out the extra columns in B */
53 for (i=0; i<mbs; i++) {
54 for (j=0; j<B->ilen[i]; j++) aj[B->i[i] + j] = indices[aj[B->i[i] + j]];
55 }
56 B->nbs = ec;
57
58 sbaij->B->cmap->n = sbaij->B->cmap->N = ec*mat->rmap->bs;
59
60 ierr = PetscLayoutSetUp((sbaij->B->cmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),60,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
61 ierr = PetscFree(indices)((*PetscTrFree)((void*)(indices),61,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),61,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
62
63 /* create local vector that is used to scatter into */
64 ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001),ec*bs,&sbaij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),64,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
65
66 /* create two temporary index sets for building scatter-gather */
67 ierr = PetscMalloc1(2*ec,&stmp)PetscMallocA(1,PETSC_FALSE,67,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(2*ec)*sizeof(**(&stmp)),(&stmp))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),67,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
68 ierr = ISCreateBlock(PETSC_COMM_SELF((MPI_Comm)0x44000001),bs,ec,garray,PETSC_COPY_VALUES,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),68,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
69 for (i=0; i<ec; i++) stmp[i] = i;
70 ierr = ISCreateBlock(PETSC_COMM_SELF((MPI_Comm)0x44000001),bs,ec,stmp,PETSC_COPY_VALUES,&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),70,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
71
72 /* generate the scatter context
73 -- Mvctx and lvec are not used by MatMult_MPISBAIJ(), but usefule for some applications */
74 ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)mat),1,mat->cmap->n,mat->cmap->N,NULL((void*)0),&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),74,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
75 ierr = VecScatterCreate(gvec,from,sbaij->lvec,to,&sbaij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76 ierr = VecDestroy(&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),76,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
77
78 sbaij->garray = garray;
79
80 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),80,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
81 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),81,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
82 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),82,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
83 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),83,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
84
85 ierr = ISDestroy(&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),85,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
86 ierr = ISDestroy(&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),86,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
87
88 /* create parallel vector that is used by SBAIJ matrix to scatter from/into */
89 lsize = (mbs + ec)*bs;
90 ierr = VecCreateMPI(PetscObjectComm((PetscObject)mat),lsize,PETSC_DETERMINE-1,&sbaij->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),90,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
91 ierr = VecDuplicate(sbaij->slvec0,&sbaij->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),91,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
92 ierr = VecGetSize(sbaij->slvec0,&vec_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),92,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
93
94 ierr = VecGetOwnershipRanges(sbaij->slvec0,&sowners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),94,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
95
96 /* x index in the IS sfrom */
97 for (i=0; i<ec; i++) {
98 j = ec_owner[i];
99 sgarray[i] = garray[i] + (sowners[j]/bs - owners[j]);
100 }
101 /* b index in the IS sfrom */
102 k = sowners[rank]/bs + mbs;
103 for (i=ec,j=0; i< 2*ec; i++,j++) sgarray[i] = k + j;
104 ierr = ISCreateBlock(PETSC_COMM_SELF((MPI_Comm)0x44000001),bs,2*ec,sgarray,PETSC_COPY_VALUES,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),104,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
105
106 /* x index in the IS sto */
107 k = sowners[rank]/bs + mbs;
108 for (i=0; i<ec; i++) stmp[i] = (k + i);
109 /* b index in the IS sto */
110 for (i=ec; i<2*ec; i++) stmp[i] = sgarray[i-ec];
111
112 ierr = ISCreateBlock(PETSC_COMM_SELF((MPI_Comm)0x44000001),bs,2*ec,stmp,PETSC_COPY_VALUES,&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
113
114 ierr = VecScatterCreate(sbaij->slvec0,from,sbaij->slvec1,to,&sbaij->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),114,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
115
116 ierr = VecGetLocalSize(sbaij->slvec1,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),116,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
117 ierr = VecGetArray(sbaij->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),117,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
118 ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,bs*mbs,ptr,&sbaij->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),118,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
119 ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,nt-bs*mbs,ptr+bs*mbs,&sbaij->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),119,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
120 ierr = VecRestoreArray(sbaij->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),120,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
121
122 ierr = VecGetArray(sbaij->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),122,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
123 ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,nt-bs*mbs,ptr+bs*mbs,&sbaij->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),123,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
124 ierr = VecRestoreArray(sbaij->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),124,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
125
126 ierr = PetscFree(stmp)((*PetscTrFree)((void*)(stmp),126,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((stmp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),126,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
127 ierr = MPI_Barrier(PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
128
129 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),129,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
130 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),130,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
131 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),131,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
132 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),132,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
133 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),133,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
134 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)sbaij->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),134,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
135 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),135,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
136 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),136,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
137
138 ierr = PetscLogObjectMemory((PetscObject)mat,(ec+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),138,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
139 ierr = ISDestroy(&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),139,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
140 ierr = ISDestroy(&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),140,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
141 ierr = PetscFree2(sgarray,ec_owner)PetscFreeA(2,141,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,&(sgarray),&(ec_owner))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),141,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
142 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
143}
144
145PetscErrorCode MatSetUpMultiply_MPISBAIJ_2comm(Mat mat)
146{
147 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
148 Mat_SeqBAIJ *B = (Mat_SeqBAIJ*)(baij->B->data);
149 PetscErrorCode ierr;
150 PetscInt i,j,*aj = B->j,ec = 0,*garray;
151 PetscInt bs = mat->rmap->bs,*stmp;
152 IS from,to;
153 Vec gvec;
154#if defined(PETSC_USE_CTABLE1)
155 PetscTable gid1_lid1;
156 PetscTablePosition tpos;
157 PetscInt gid,lid;
158#else
159 PetscInt Nbs = baij->Nbs,*indices;
160#endif
161
162 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
; petscstack->line[petscstack->currentsize] = 162; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
163#if defined(PETSC_USE_CTABLE1)
164 /* use a table - Mark Adams */
165 PetscTableCreate(B->mbs,baij->Nbs+1,&gid1_lid1);
166 for (i=0; i<B->mbs; i++) {
1
Assuming the condition is true
2
Loop condition is true. Entering loop body
5
Assuming the condition is true
6
Loop condition is true. Entering loop body
9
Assuming the condition is true
10
Loop condition is true. Entering loop body
13
Assuming the condition is true
14
Loop condition is true. Entering loop body
167 for (j=0; j<B->ilen[i]; j++) {
3
Assuming the condition is false
4
Loop condition is false. Execution continues on line 166
7
Assuming the condition is false
8
Loop condition is false. Execution continues on line 166
11
Assuming the condition is false
12
Loop condition is false. Execution continues on line 166
15
Assuming the condition is true
16
Loop condition is true. Entering loop body
168 PetscInt data,gid1 = aj[B->i[i]+j] + 1;
169 ierr = PetscTableFind(gid1_lid1,gid1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),169,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
170 if (!data) {
17
Taking true branch
171 /* one based table */
172 ierr = PetscTableAdd(gid1_lid1,gid1,++ec,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),172,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
18
Calling 'PetscTableAdd'
173 }
174 }
175 }
176 /* form array of columns we need */
177 ierr = PetscMalloc1(ec,&garray)PetscMallocA(1,PETSC_FALSE,177,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(ec)*sizeof(**(&garray)),(&garray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),177,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
178 ierr = PetscTableGetHeadPosition(gid1_lid1,&tpos);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),178,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
179 while (tpos) {
180 ierr = PetscTableGetNext(gid1_lid1,&tpos,&gid,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),180,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
181 gid--; lid--;
182 garray[lid] = gid;
183 }
184 ierr = PetscSortInt(ec,garray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),184,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
185 ierr = PetscTableRemoveAll(gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),185,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
186 for (i=0; i<ec; i++) {
187 ierr = PetscTableAdd(gid1_lid1,garray[i]+1,i+1,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),187,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
188 }
189 /* compact out the extra columns in B */
190 for (i=0; i<B->mbs; i++) {
191 for (j=0; j<B->ilen[i]; j++) {
192 PetscInt gid1 = aj[B->i[i] + j] + 1;
193 ierr = PetscTableFind(gid1_lid1,gid1,&lid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),193,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
194 lid--;
195 aj[B->i[i]+j] = lid;
196 }
197 }
198 B->nbs = ec;
199
200 baij->B->cmap->n = baij->B->cmap->N = ec*mat->rmap->bs;
201
202 ierr = PetscLayoutSetUp((baij->B->cmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),202,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
203 ierr = PetscTableDestroy(&gid1_lid1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),203,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
204#else
205 /* For the first stab we make an array as long as the number of columns */
206 /* mark those columns that are in baij->B */
207 ierr = PetscCalloc1(Nbs,&indices)PetscMallocA(1,PETSC_TRUE,207,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(Nbs)*sizeof(**(&indices)),(&indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),207,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
208 for (i=0; i<B->mbs; i++) {
209 for (j=0; j<B->ilen[i]; j++) {
210 if (!indices[aj[B->i[i] + j]]) ec++;
211 indices[aj[B->i[i] + j]] = 1;
212 }
213 }
214
215 /* form array of columns we need */
216 ierr = PetscMalloc1(ec,&garray)PetscMallocA(1,PETSC_FALSE,216,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(ec)*sizeof(**(&garray)),(&garray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),216,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
217 ec = 0;
218 for (i=0; i<Nbs; i++) {
219 if (indices[i]) {
220 garray[ec++] = i;
221 }
222 }
223
224 /* make indices now point into garray */
225 for (i=0; i<ec; i++) indices[garray[i]] = i;
226
227 /* compact out the extra columns in B */
228 for (i=0; i<B->mbs; i++) {
229 for (j=0; j<B->ilen[i]; j++) {
230 aj[B->i[i] + j] = indices[aj[B->i[i] + j]];
231 }
232 }
233 B->nbs = ec;
234
235 baij->B->cmap->n = ec*mat->rmap->bs;
236
237 ierr = PetscFree(indices)((*PetscTrFree)((void*)(indices),237,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238#endif
239
240 /* create local vector that is used to scatter into */
241 ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001),ec*bs,&baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),241,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
242
243 /* create two temporary index sets for building scatter-gather */
244 ierr = ISCreateBlock(PETSC_COMM_SELF((MPI_Comm)0x44000001),bs,ec,garray,PETSC_COPY_VALUES,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),244,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
245
246 ierr = PetscMalloc1(ec,&stmp)PetscMallocA(1,PETSC_FALSE,246,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(ec)*sizeof(**(&stmp)),(&stmp))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),246,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
247 for (i=0; i<ec; i++) stmp[i] = i;
248 ierr = ISCreateBlock(PETSC_COMM_SELF((MPI_Comm)0x44000001),bs,ec,stmp,PETSC_OWN_POINTER,&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),248,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
249
250 /* create temporary global vector to generate scatter context */
251 ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)mat),1,mat->cmap->n,mat->cmap->N,NULL((void*)0),&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),251,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
252 ierr = VecScatterCreate(gvec,from,baij->lvec,to,&baij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),252,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
253 ierr = VecDestroy(&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),253,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254
255 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)baij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),255,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
256 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),256,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
257 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),257,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
258 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),258,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
259
260 baij->garray = garray;
261
262 ierr = PetscLogObjectMemory((PetscObject)mat,(ec+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),262,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
263 ierr = ISDestroy(&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),263,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
264 ierr = ISDestroy(&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),264,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
265 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
266}
267
268/*
269 Takes the local part of an already assembled MPISBAIJ matrix
270 and disassembles it. This is to allow new nonzeros into the matrix
271 that require more communication in the matrix vector multiply.
272 Thus certain data-structures must be rebuilt.
273
274 Kind of slow! But that's what application programmers get when
275 they are sloppy.
276*/
277PetscErrorCode MatDisAssemble_MPISBAIJ(Mat A)
278{
279 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)A->data;
280 Mat B = baij->B,Bnew;
281 Mat_SeqBAIJ *Bbaij = (Mat_SeqBAIJ*)B->data;
282 PetscErrorCode ierr;
283 PetscInt i,j,mbs=Bbaij->mbs,n = A->cmap->N,col,*garray=baij->garray;
284 PetscInt k,bs=A->rmap->bs,bs2=baij->bs2,*rvals,*nz,ec,m=A->rmap->n;
285 MatScalar *a = Bbaij->a;
286 PetscScalar *atmp;
287#if defined(PETSC_USE_REAL_MAT_SINGLE)
288 PetscInt l;
289#endif
290
291 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.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 defined(PETSC_USE_REAL_MAT_SINGLE)
293 ierr = PetscMalloc1(A->rmap->bs,&atmp)PetscMallocA(1,PETSC_FALSE,293,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(A->rmap->bs)*sizeof(**(&atmp)),(&atmp
))
;
294#endif
295 /* free stuff related to matrix-vec multiply */
296 ierr = VecGetSize(baij->lvec,&ec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* needed for PetscLogObjectMemory below */
297 ierr = VecDestroy(&baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),297,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
298 ierr = VecScatterDestroy(&baij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),298,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
299
300 ierr = VecDestroy(&baij->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),300,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
301 ierr = VecDestroy(&baij->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),301,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
302 ierr = VecDestroy(&baij->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),302,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
303 ierr = VecDestroy(&baij->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),303,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
304 ierr = VecDestroy(&baij->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),304,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
305
306 if (baij->colmap) {
307#if defined(PETSC_USE_CTABLE1)
308 ierr = PetscTableDestroy(&baij->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),308,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
309#else
310 ierr = PetscFree(baij->colmap)((*PetscTrFree)((void*)(baij->colmap),310,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((baij->colmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),310,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
311 ierr = PetscLogObjectMemory((PetscObject)A,-Bbaij->nbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),311,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
312#endif
313 }
314
315 /* make sure that B is assembled so we can access its values */
316 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),316,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
317 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),317,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
318
319 /* invent new B and copy stuff over */
320 ierr = PetscMalloc1(mbs,&nz)PetscMallocA(1,PETSC_FALSE,320,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(mbs)*sizeof(**(&nz)),(&nz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),320,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
321 for (i=0; i<mbs; i++) {
322 nz[i] = Bbaij->i[i+1]-Bbaij->i[i];
323 }
324 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&Bnew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),324,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
325 ierr = MatSetSizes(Bnew,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),325,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
326 ierr = MatSetType(Bnew,((PetscObject)B)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),326,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
327 ierr = MatSeqBAIJSetPreallocation(Bnew,B->rmap->bs,0,nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),327,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
328 ierr = PetscFree(nz)((*PetscTrFree)((void*)(nz),328,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((nz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),328,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
329
330 if (Bbaij->nonew >= 0) { /* Inherit insertion error options (if positive). */
331 ((Mat_SeqSBAIJ*)Bnew->data)->nonew = Bbaij->nonew;
332 }
333
334 /*
335 Ensure that B's nonzerostate is monotonically increasing.
336 Or should this follow the MatSetValues() loop to preserve B's nonzerstate across a MatDisAssemble() call?
337 */
338 Bnew->nonzerostate = B->nonzerostate;
339 ierr = PetscMalloc1(bs,&rvals)PetscMallocA(1,PETSC_FALSE,339,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,(size_t)(bs)*sizeof(**(&rvals)),(&rvals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),339,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
340 for (i=0; i<mbs; i++) {
341 rvals[0] = bs*i;
342 for (j=1; j<bs; j++) rvals[j] = rvals[j-1] + 1;
343 for (j=Bbaij->i[i]; j<Bbaij->i[i+1]; j++) {
344 col = garray[Bbaij->j[j]]*bs;
345 for (k=0; k<bs; k++) {
346#if defined(PETSC_USE_REAL_MAT_SINGLE)
347 for (l=0; l<bs; l++) atmp[l] = a[j*bs2+l];
348#else
349 atmp = a+j*bs2 + k*bs;
350#endif
351 ierr = MatSetValues_SeqSBAIJ(Bnew,bs,rvals,1,&col,atmp,B->insertmode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),351,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
352 col++;
353 }
354 }
355 }
356#if defined(PETSC_USE_REAL_MAT_SINGLE)
357 ierr = PetscFree(atmp)((*PetscTrFree)((void*)(atmp),357,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((atmp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),357,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
358#endif
359 ierr = PetscFree(baij->garray)((*PetscTrFree)((void*)(baij->garray),359,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((baij->garray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),359,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
360
361 baij->garray = 0;
362
363 ierr = PetscFree(rvals)((*PetscTrFree)((void*)(rvals),363,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
) || ((rvals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),363,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
364 ierr = PetscLogObjectMemory((PetscObject)A,-ec*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),364,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
365 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),365,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
366 ierr = PetscLogObjectParent((PetscObject)A,(PetscObject)Bnew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),366,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mmsbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
367
368 baij->B = Bnew;
369
370 A->was_assembled = PETSC_FALSE;
371 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
372}

/sandbox/petsc/petsc.next/include/petscctable.h

1#ifndef __PETSCCTABLE_H
2#define __PETSCCTABLE_H
3#include <petscsys.h>
4
5struct _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
14typedef struct _n_PetscTable* PetscTable;
15typedef PetscInt* PetscTablePosition;
16
17PETSC_STATIC_INLINEstatic inline unsigned long PetscHash(PetscTable ta,unsigned long x)
18{
19 return(x%(unsigned long)ta->tablesize);
20}
21
22PETSC_STATIC_INLINEstatic inline unsigned long PetscHashStep(PetscTable ta,unsigned long x)
23{
24 return(1+(x%(unsigned long)(ta->tablesize-1)));
20
Division by zero
25}
26
27PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreate(const PetscInt,PetscInt,PetscTable*);
28PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreateCopy(const PetscTable,PetscTable*);
29PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableDestroy(PetscTable*);
30PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetCount(const PetscTable,PetscInt*);
31PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableIsEmpty(const PetscTable,PetscInt*);
32PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddExpand(PetscTable,PetscInt,PetscInt,InsertMode);
33PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddCountExpand(PetscTable,PetscInt);
34PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetHeadPosition(PetscTable,PetscTablePosition*);
35PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetNext(PetscTable,PetscTablePosition*,PetscInt*,PetscInt*);
36PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableRemoveAll(PetscTable);
37
38PETSC_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);
19
Calling 'PetscHashStep'
43
44 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/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/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)return PetscError(((MPI_Comm)0x44000001),46,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D"
,key,ta->maxkey)
;
47 if (!data) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Null data")return PetscError(((MPI_Comm)0x44000001),47,__func__,"/sandbox/petsc/petsc.next/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/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)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,ierr,PETSC_ERROR_REPEAT," ");} 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/include/petscctable.h"
,74,PETSC_ERROR_INITIAL,"Full table")
;
82 /* PetscFunctionReturn(0); */
83}
84
85PETSC_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/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/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)return PetscError(((MPI_Comm)0x44000001),93,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D"
,key,ta->maxkey)
;
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)) return PetscError(((MPI_Comm
)0x44000001),104,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,ierr,PETSC_ERROR_REPEAT," ");} 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/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*/
120PETSC_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/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/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)return PetscError(((MPI_Comm)0x44000001),129,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D"
,key,ta->maxkey)
;
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