Bug Summary

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

Annotated Source Code

[?] Use j/k keys for keyboard navigation

/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c

1
2#include <../src/mat/impls/baij/mpi/mpibaij.h> /*I "petscmat.h" I*/
3#include <../src/mat/impls/sbaij/mpi/mpisbaij.h>
4#include <../src/mat/impls/sbaij/seq/sbaij.h>
5#include <petscblaslapack.h>
6
7#if defined(PETSC_HAVE_ELEMENTAL)
8PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_MPISBAIJ_Elemental(Mat,MatType,MatReuse,Mat*);
9#endif
10
11/* This could be moved to matimpl.h */
12static PetscErrorCode MatPreallocateWithMats_Private(Mat B, PetscInt nm, Mat X[], PetscBool symm[], PetscBool fill)
13{
14 Mat preallocator;
15 PetscInt r,rstart,rend;
16 PetscInt bs,i,m,n,M,N;
17 PetscBool cong = PETSC_TRUE;
18 PetscErrorCode ierr;
19
20 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 20; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
21 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),21,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),21,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.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),21,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),21,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
22 PetscValidLogicalCollectiveInt(B,nm,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nm
; b1[1] = nm; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)B),2,22,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),22,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)B),22,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
23 for (i = 0; i < nm; i++) {
24 PetscValidHeaderSpecific(X[i],MAT_CLASSID,3)do { if (!X[i]) return PetscError(((MPI_Comm)0x44000001),24,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(X[i],PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),24,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(X[i]))->classid != MAT_CLASSID) { if
(((PetscObject)(X[i]))->classid == -1) return PetscError(
((MPI_Comm)0x44000001),24,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),24,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,3); } } while (0)
;
25 ierr = PetscLayoutCompare(B->rmap,X[i]->rmap,&cong);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
26 if (!cong) SETERRQ(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"Not for different layouts")return PetscError(PetscObjectComm((PetscObject)B),26,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Not for different layouts")
;
27 }
28 PetscValidLogicalCollectiveBool(B,fill,5)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)fill; b1[1] = (PetscMPIInt)fill; _7_ierr = (PetscAllreduceBarrierCheck
(PetscObjectComm((PetscObject)B),2,28,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),28,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)B),28,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,5); } while (0)
;
29 ierr = MatGetBlockSize(B,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),29,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
30 ierr = MatGetSize(B,&M,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),30,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
31 ierr = MatGetLocalSize(B,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),31,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
32 ierr = MatCreate(PetscObjectComm((PetscObject)B),&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),32,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
33 ierr = MatSetType(preallocator,MATPREALLOCATOR"preallocator");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
34 ierr = MatSetBlockSize(preallocator,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),34,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
35 ierr = MatSetSizes(preallocator,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),35,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
36 ierr = MatSetUp(preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),36,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
37 ierr = MatGetOwnershipRange(preallocator,&rstart,&rend);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),37,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
38 for (r = rstart; r < rend; ++r) {
39 PetscInt ncols;
40 const PetscInt *row;
41 const PetscScalar *vals;
42
43 for (i = 0; i < nm; i++) {
44 ierr = MatGetRow(X[i],r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),44,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
45 ierr = MatSetValues(preallocator,1,&r,ncols,row,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),45,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
46 if (symm && symm[i]) {
47 ierr = MatSetValues(preallocator,ncols,row,1,&r,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
48 }
49 ierr = MatRestoreRow(X[i],r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),49,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
50 }
51 }
52 ierr = MatAssemblyBegin(preallocator,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),52,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
53 ierr = MatAssemblyEnd(preallocator,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),53,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
54 ierr = MatPreallocatorPreallocate(preallocator,fill,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),54,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
55 ierr = MatDestroy(&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),55,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
56 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
57}
58
59static PetscErrorCode MatConvert_MPISBAIJ_XAIJ(Mat A, MatType newtype, MatReuse reuse, Mat *newmat)
60{
61 Mat B;
62 PetscErrorCode ierr;
63 PetscInt r;
64
65 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 65; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
66 if (reuse != MAT_REUSE_MATRIX) {
67 PetscBool symm = PETSC_TRUE;
68 PetscInt bs;
69
70 ierr = MatCreate(PetscObjectComm((PetscObject)A),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),70,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
71 ierr = MatSetSizes(B,A->rmap->n,A->cmap->n,A->rmap->N,A->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
72 ierr = MatSetType(B,newtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
73 ierr = MatGetBlockSize(A,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
74 ierr = MatSetBlockSize(B,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),74,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
75 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),76,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
77 ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),77,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
78 ierr = MatPreallocateWithMats_Private(B,1,&A,&symm,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),78,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
79 ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),79,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
80 } else B = *newmat;
81
82 ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),82,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
83 for (r = A->rmap->rstart; r < A->rmap->rend; r++) {
84 PetscInt ncols;
85 const PetscInt *row;
86 const PetscScalar *vals;
87
88 ierr = MatGetRow(A,r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
89 ierr = MatSetValues(B,1,&r,ncols,row,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),89,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
90 ierr = MatSetValues(B,ncols,row,1,&r,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),90,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
91 ierr = MatRestoreRow(A,r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),91,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
92 }
93 ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),93,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
94 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),94,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
95 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
96
97 if (reuse == MAT_INPLACE_MATRIX) {
98 ierr = MatHeaderReplace(A,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),98,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
99 } else {
100 *newmat = B;
101 }
102 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
103}
104
105PetscErrorCode MatStoreValues_MPISBAIJ(Mat mat)
106{
107 Mat_MPISBAIJ *aij = (Mat_MPISBAIJ*)mat->data;
108 PetscErrorCode ierr;
109
110 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 110; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
111 ierr = MatStoreValues(aij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),111,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
112 ierr = MatStoreValues(aij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
113 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
114}
115
116PetscErrorCode MatRetrieveValues_MPISBAIJ(Mat mat)
117{
118 Mat_MPISBAIJ *aij = (Mat_MPISBAIJ*)mat->data;
119 PetscErrorCode ierr;
120
121 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 121; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
122 ierr = MatRetrieveValues(aij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
123 ierr = MatRetrieveValues(aij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
124 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
125}
126
127#define MatSetValues_SeqSBAIJ_A_Private(row,col,value,addv,orow,ocol){ brow = row/bs; rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; rmax
= aimax[brow]; nrow = ailen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
a_noinsert; } } if (a->nonew == 1) goto a_noinsert; if (a
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),127
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)A->data; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (a->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)*
sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow
]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow
]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[brow
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(ai[brow]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[brow]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[brow]+nrow+CHUNKSIZE
),aa+bs2*(ai[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[brow
]+nrow+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow
]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));;
do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));;do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; A->nonzerostate++;a_noinsert
:; ailen[brow] = nrow; }
\
128 { \
129 brow = row/bs; \
130 rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; \
131 rmax = aimax[brow]; nrow = ailen[brow]; \
132 bcol = col/bs; \
133 ridx = row % bs; cidx = col % bs; \
134 low = 0; high = nrow; \
135 while (high-low > 3) { \
136 t = (low+high)/2; \
137 if (rp[t] > bcol) high = t; \
138 else low = t; \
139 } \
140 for (_i=low; _i<high; _i++) { \
141 if (rp[_i] > bcol) break; \
142 if (rp[_i] == bcol) { \
143 bap = ap + bs2*_i + bs*cidx + ridx; \
144 if (addv == ADD_VALUES) *bap += value; \
145 else *bap = value; \
146 goto a_noinsert; \
147 } \
148 } \
149 if (a->nonew == 1) goto a_noinsert; \
150 if (a->nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at global row/column (%D, %D) into matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),150,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol)
; \
151 MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,brow,bcol,rmax,aa,ai,aj,rp,ap,aimax,a->nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (a->nonew == -
2) return PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),151,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)*
sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow
]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow
]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[brow
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(ai[brow]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[brow]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[brow]+nrow+CHUNKSIZE
),aa+bs2*(ai[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[brow
]+nrow+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),151,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow
]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }
; \
152 N = nrow++ - 1; \
153 /* shift up all the later entries in this row */ \
154 ierr = PetscArraymove(rp+_i+1,rp+_i,N-_i+1)((sizeof(*(rp+_i+1)) != sizeof(*(rp+_i))) || PetscMemmove(rp+
_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i+1))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),154,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
155 ierr = PetscArraymove(ap+bs2*(_i+1),ap+bs2*_i,bs2*(N-_i+1))((sizeof(*(ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove
(ap+bs2*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1
)))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
156 ierr = PetscArrayzero(ap+bs2*_i,bs2)PetscMemzero(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),156,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
157 rp[_i] = bcol; \
158 ap[bs2*_i + bs*cidx + ridx] = value; \
159 A->nonzerostate++;\
160a_noinsert:; \
161 ailen[brow] = nrow; \
162 }
163
164#define MatSetValues_SeqSBAIJ_B_Private(row,col,value,addv,orow,ocol){ brow = row/bs; rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; rmax
= bimax[brow]; nrow = bilen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
b_noinsert; } } if (b->nonew == 1) goto b_noinsert; if (b
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),164
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)B->data; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (b->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs
+1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(bj))) || PetscMemcpy(new_j,bj,(bi[brow]+nrow)*
sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- bi[brow] - nrow); ierr = ((sizeof(*(new_j+bi[brow]+nrow+CHUNKSIZE
)) != sizeof(*(bj+bi[brow]+nrow))) || PetscMemcpy(new_j+bi[brow
]+nrow+CHUNKSIZE,bj+bi[brow]+nrow,(len)*sizeof(*(new_j+bi[brow
]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(ba))) || PetscMemcpy(new_a,ba,(bs2*(bi[brow
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(bi[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(bi[brow]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(bi[brow]+nrow+CHUNKSIZE))) != sizeof(*(ba+bs2*(bi[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(bi[brow]+nrow+CHUNKSIZE
),ba+bs2*(bi[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(bi[brow
]+nrow+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain->
a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow
]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));;
do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));;do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; B->nonzerostate++;b_noinsert
:; bilen[brow] = nrow; }
\
165 { \
166 brow = row/bs; \
167 rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; \
168 rmax = bimax[brow]; nrow = bilen[brow]; \
169 bcol = col/bs; \
170 ridx = row % bs; cidx = col % bs; \
171 low = 0; high = nrow; \
172 while (high-low > 3) { \
173 t = (low+high)/2; \
174 if (rp[t] > bcol) high = t; \
175 else low = t; \
176 } \
177 for (_i=low; _i<high; _i++) { \
178 if (rp[_i] > bcol) break; \
179 if (rp[_i] == bcol) { \
180 bap = ap + bs2*_i + bs*cidx + ridx; \
181 if (addv == ADD_VALUES) *bap += value; \
182 else *bap = value; \
183 goto b_noinsert; \
184 } \
185 } \
186 if (b->nonew == 1) goto b_noinsert; \
187 if (b->nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at global row/column (%D, %D) into matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),187,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol)
; \
188 MatSeqXAIJReallocateAIJ(B,b->mbs,bs2,nrow,brow,bcol,rmax,ba,bi,bj,rp,ap,bimax,b->nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)B->data
; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (b->nonew == -
2) return PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),188,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs
+1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(bj))) || PetscMemcpy(new_j,bj,(bi[brow]+nrow)*
sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- bi[brow] - nrow); ierr = ((sizeof(*(new_j+bi[brow]+nrow+CHUNKSIZE
)) != sizeof(*(bj+bi[brow]+nrow))) || PetscMemcpy(new_j+bi[brow
]+nrow+CHUNKSIZE,bj+bi[brow]+nrow,(len)*sizeof(*(new_j+bi[brow
]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(ba))) || PetscMemcpy(new_a,ba,(bs2*(bi[brow
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(bi[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(bi[brow]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(bi[brow]+nrow+CHUNKSIZE))) != sizeof(*(ba+bs2*(bi[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(bi[brow]+nrow+CHUNKSIZE
),ba+bs2*(bi[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(bi[brow
]+nrow+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),188,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain->
a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow
]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }
; \
189 N = nrow++ - 1; \
190 /* shift up all the later entries in this row */ \
191 ierr = PetscArraymove(rp+_i+1,rp+_i,N-_i+1)((sizeof(*(rp+_i+1)) != sizeof(*(rp+_i))) || PetscMemmove(rp+
_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i+1))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
192 ierr = PetscArraymove(ap+bs2*(_i+1),ap+bs2*_i,bs2*(N-_i+1))((sizeof(*(ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove
(ap+bs2*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1
)))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),192,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
193 ierr = PetscArrayzero(ap+bs2*_i,bs2)PetscMemzero(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
194 rp[_i] = bcol; \
195 ap[bs2*_i + bs*cidx + ridx] = value; \
196 B->nonzerostate++;\
197b_noinsert:; \
198 bilen[brow] = nrow; \
199 }
200
201/* Only add/insert a(i,j) with i<=j (blocks).
202 Any a(i,j) with i>j input by user is ingored.
203*/
204PetscErrorCode MatSetValues_MPISBAIJ(Mat mat,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode addv)
205{
206 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
207 MatScalar value;
208 PetscBool roworiented = baij->roworiented;
209 PetscErrorCode ierr;
210 PetscInt i,j,row,col;
211 PetscInt rstart_orig=mat->rmap->rstart;
212 PetscInt rend_orig =mat->rmap->rend,cstart_orig=mat->cmap->rstart;
213 PetscInt cend_orig =mat->cmap->rend,bs=mat->rmap->bs;
214
215 /* Some Variables required in the macro */
216 Mat A = baij->A;
217 Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)(A)->data;
218 PetscInt *aimax=a->imax,*ai=a->i,*ailen=a->ilen,*aj=a->j;
219 MatScalar *aa =a->a;
220
221 Mat B = baij->B;
222 Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)(B)->data;
223 PetscInt *bimax=b->imax,*bi=b->i,*bilen=b->ilen,*bj=b->j;
224 MatScalar *ba =b->a;
225
226 PetscInt *rp,ii,nrow,_i,rmax,N,brow,bcol;
227 PetscInt low,high,t,ridx,cidx,bs2=a->bs2;
228 MatScalar *ap,*bap;
229
230 /* for stash */
231 PetscInt n_loc, *in_loc = NULL((void*)0);
232 MatScalar *v_loc = NULL((void*)0);
233
234 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 234; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
235 if (!baij->donotstash) {
236 if (n > baij->n_loc) {
237 ierr = PetscFree(baij->in_loc)((*PetscTrFree)((void*)(baij->in_loc),237,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->in_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 ierr = PetscFree(baij->v_loc)((*PetscTrFree)((void*)(baij->v_loc),238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->v_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
239 ierr = PetscMalloc1(n,&baij->in_loc)PetscMallocA(1,PETSC_FALSE,239,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(n)*sizeof(**(&baij->in_loc)),(&baij->
in_loc))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),239,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
240 ierr = PetscMalloc1(n,&baij->v_loc)PetscMallocA(1,PETSC_FALSE,240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(n)*sizeof(**(&baij->v_loc)),(&baij->v_loc
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
241
242 baij->n_loc = n;
243 }
244 in_loc = baij->in_loc;
245 v_loc = baij->v_loc;
246 }
247
248 for (i=0; i<m; i++) {
249 if (im[i] < 0) continue;
250#if defined(PETSC_USE_DEBUG1)
251 if (im[i] >= mat->rmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",im[i],mat->rmap->N-1)return PetscError(((MPI_Comm)0x44000001),251,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Row too large: row %D max %D",im[i],
mat->rmap->N-1)
;
252#endif
253 if (im[i] >= rstart_orig && im[i] < rend_orig) { /* this processor entry */
254 row = im[i] - rstart_orig; /* local row index */
255 for (j=0; j<n; j++) {
256 if (im[i]/bs > in[j]/bs) {
257 if (a->ignore_ltriangular) {
258 continue; /* ignore lower triangular blocks */
259 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),259,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)"
)
;
260 }
261 if (in[j] >= cstart_orig && in[j] < cend_orig) { /* diag entry (A) */
262 col = in[j] - cstart_orig; /* local col index */
263 brow = row/bs; bcol = col/bs;
264 if (brow > bcol) continue; /* ignore lower triangular blocks of A */
265 if (roworiented) value = v[i*n+j];
266 else value = v[i+j*m];
267 MatSetValues_SeqSBAIJ_A_Private(row,col,value,addv,im[i],in[j]){ brow = row/bs; rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; rmax
= aimax[brow]; nrow = ailen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
a_noinsert; } } if (a->nonew == 1) goto a_noinsert; if (a
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),267
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,im[i],in[j]); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)A->data; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (a->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)*
sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow
]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow
]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[brow
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(ai[brow]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[brow]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[brow]+nrow+CHUNKSIZE
),aa+bs2*(ai[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[brow
]+nrow+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow
]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));;
do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));;do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; A->nonzerostate++;a_noinsert
:; ailen[brow] = nrow; }
;
268 /* ierr = MatSetValues_SeqBAIJ(baij->A,1,&row,1,&col,&value,addv);CHKERRQ(ierr); */
269 } else if (in[j] < 0) continue;
270#if defined(PETSC_USE_DEBUG1)
271 else if (in[j] >= mat->cmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[j],mat->cmap->N-1)return PetscError(((MPI_Comm)0x44000001),271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Column too large: col %D max %D",in[
j],mat->cmap->N-1)
;
272#endif
273 else { /* off-diag entry (B) */
274 if (mat->was_assembled) {
275 if (!baij->colmap) {
276 ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
277 }
278#if defined(PETSC_USE_CTABLE1)
279 ierr = PetscTableFind(baij->colmap,in[j]/bs + 1,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
280 col = col - 1;
281#else
282 col = baij->colmap[in[j]/bs] - 1;
283#endif
284 if (col < 0 && !((Mat_SeqSBAIJ*)(baij->A->data))->nonew) {
285 ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
286 col = in[j];
287 /* Reinitialize the variables required by MatSetValues_SeqBAIJ_B_Private() */
288 B = baij->B;
289 b = (Mat_SeqBAIJ*)(B)->data;
290 bimax= b->imax;bi=b->i;bilen=b->ilen;bj=b->j;
291 ba = b->a;
292 } else col += in[j]%bs;
293 } else col = in[j];
294 if (roworiented) value = v[i*n+j];
295 else value = v[i+j*m];
296 MatSetValues_SeqSBAIJ_B_Private(row,col,value,addv,im[i],in[j]){ brow = row/bs; rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; rmax
= bimax[brow]; nrow = bilen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
b_noinsert; } } if (b->nonew == 1) goto b_noinsert; if (b
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),296
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,im[i],in[j]); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)B->data; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (b->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs
+1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(bj))) || PetscMemcpy(new_j,bj,(bi[brow]+nrow)*
sizeof(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- bi[brow] - nrow); ierr = ((sizeof(*(new_j+bi[brow]+nrow+CHUNKSIZE
)) != sizeof(*(bj+bi[brow]+nrow))) || PetscMemcpy(new_j+bi[brow
]+nrow+CHUNKSIZE,bj+bi[brow]+nrow,(len)*sizeof(*(new_j+bi[brow
]+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(ba))) || PetscMemcpy(new_a,ba,(bs2*(bi[brow
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(bi[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(bi[brow]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(bi[brow]+nrow+CHUNKSIZE))) != sizeof(*(ba+bs2*(bi[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(bi[brow]+nrow+CHUNKSIZE
),ba+bs2*(bi[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(bi[brow
]+nrow+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain->
a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow
]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));;
do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));;do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; B->nonzerostate++;b_noinsert
:; bilen[brow] = nrow; }
;
297 /* ierr = MatSetValues_SeqBAIJ(baij->B,1,&row,1,&col,&value,addv);CHKERRQ(ierr); */
298 }
299 }
300 } else { /* off processor entry */
301 if (mat->nooffprocentries) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Setting off process row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set",im[i])return PetscError(((MPI_Comm)0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Setting off process row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set"
,im[i])
;
302 if (!baij->donotstash) {
303 mat->assembled = PETSC_FALSE;
304 n_loc = 0;
305 for (j=0; j<n; j++) {
306 if (im[i]/bs > in[j]/bs) continue; /* ignore lower triangular blocks */
307 in_loc[n_loc] = in[j];
308 if (roworiented) {
309 v_loc[n_loc] = v[i*n+j];
310 } else {
311 v_loc[n_loc] = v[j*m+i];
312 }
313 n_loc++;
314 }
315 ierr = MatStashValuesRow_Private(&mat->stash,im[i],n_loc,in_loc,v_loc,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),315,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
316 }
317 }
318 }
319 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
320}
321
322PETSC_STATIC_INLINEstatic inline PetscErrorCode MatSetValuesBlocked_SeqSBAIJ_Inlined(Mat A,PetscInt row,PetscInt col,const PetscScalar v[],InsertMode is,PetscInt orow,PetscInt ocol)
323{
324 Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)A->data;
325 PetscErrorCode ierr;
326 PetscInt *rp,low,high,t,ii,jj,nrow,i,rmax,N;
327 PetscInt *imax =a->imax,*ai=a->i,*ailen=a->ilen;
328 PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs;
329 PetscBool roworiented=a->roworiented;
330 const PetscScalar *value = v;
331 MatScalar *ap,*aa = a->a,*bap;
332
333 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 333; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
334 if (col < row) {
335 if (a->ignore_ltriangular) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
; /* ignore lower triangular block */
336 else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)"
)
;
337 }
338 rp = aj + ai[row];
339 ap = aa + bs2*ai[row];
340 rmax = imax[row];
341 nrow = ailen[row];
342 value = v;
343 low = 0;
344 high = nrow;
345
346 while (high-low > 7) {
347 t = (low+high)/2;
348 if (rp[t] > col) high = t;
349 else low = t;
350 }
351 for (i=low; i<high; i++) {
352 if (rp[i] > col) break;
353 if (rp[i] == col) {
354 bap = ap + bs2*i;
355 if (roworiented) {
356 if (is == ADD_VALUES) {
357 for (ii=0; ii<bs; ii++) {
358 for (jj=ii; jj<bs2; jj+=bs) {
359 bap[jj] += *value++;
360 }
361 }
362 } else {
363 for (ii=0; ii<bs; ii++) {
364 for (jj=ii; jj<bs2; jj+=bs) {
365 bap[jj] = *value++;
366 }
367 }
368 }
369 } else {
370 if (is == ADD_VALUES) {
371 for (ii=0; ii<bs; ii++) {
372 for (jj=0; jj<bs; jj++) {
373 *bap++ += *value++;
374 }
375 }
376 } else {
377 for (ii=0; ii<bs; ii++) {
378 for (jj=0; jj<bs; jj++) {
379 *bap++ = *value++;
380 }
381 }
382 }
383 }
384 goto noinsert2;
385 }
386 }
387 if (nonew == 1) goto noinsert2;
388 if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new block index nonzero block (%D, %D) in the matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new block index nonzero block (%D, %D) in the matrix"
,orow,ocol)
;
389 MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return
PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,row,col); ierr = PetscMallocA(3,PETSC_FALSE,389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),389,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row
+1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof
(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row
]+nrow+CHUNKSIZE,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]
+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[row
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[row]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2*
(ai[row]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[row]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[row
]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[row]+nrow+CHUNKSIZE),
aa+bs2*(ai[row]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[row]+nrow
+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),389,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row
]; ap = aa + bs2*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE
; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }
;
390 N = nrow++ - 1; high++;
391 /* shift up all the later entries in this row */
392 ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+
1,rp+i,(N-i+1)*sizeof(*(rp+i+1))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),392,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
393 ierr = PetscArraymove(ap+bs2*(i+1),ap+bs2*i,bs2*(N-i+1))((sizeof(*(ap+bs2*(i+1))) != sizeof(*(ap+bs2*i))) || PetscMemmove
(ap+bs2*(i+1),ap+bs2*i,(bs2*(N-i+1))*sizeof(*(ap+bs2*(i+1))))
);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
394 rp[i] = col;
395 bap = ap + bs2*i;
396 if (roworiented) {
397 for (ii=0; ii<bs; ii++) {
398 for (jj=ii; jj<bs2; jj+=bs) {
399 bap[jj] = *value++;
400 }
401 }
402 } else {
403 for (ii=0; ii<bs; ii++) {
404 for (jj=0; jj<bs; jj++) {
405 *bap++ = *value++;
406 }
407 }
408 }
409 noinsert2:;
410 ailen[row] = nrow;
411 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
412}
413
414/*
415 This routine is exactly duplicated in mpibaij.c
416*/
417PETSC_STATIC_INLINEstatic inline PetscErrorCode MatSetValuesBlocked_SeqBAIJ_Inlined(Mat A,PetscInt row,PetscInt col,const PetscScalar v[],InsertMode is,PetscInt orow,PetscInt ocol)
418{
419 Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data;
420 PetscInt *rp,low,high,t,ii,jj,nrow,i,rmax,N;
421 PetscInt *imax=a->imax,*ai=a->i,*ailen=a->ilen;
422 PetscErrorCode ierr;
423 PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs;
424 PetscBool roworiented=a->roworiented;
425 const PetscScalar *value = v;
426 MatScalar *ap,*aa = a->a,*bap;
427
428 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 428; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
429 rp = aj + ai[row];
430 ap = aa + bs2*ai[row];
431 rmax = imax[row];
432 nrow = ailen[row];
433 low = 0;
434 high = nrow;
435 value = v;
436 while (high-low > 7) {
437 t = (low+high)/2;
438 if (rp[t] > col) high = t;
439 else low = t;
440 }
441 for (i=low; i<high; i++) {
442 if (rp[i] > col) break;
443 if (rp[i] == col) {
444 bap = ap + bs2*i;
445 if (roworiented) {
446 if (is == ADD_VALUES) {
447 for (ii=0; ii<bs; ii++) {
448 for (jj=ii; jj<bs2; jj+=bs) {
449 bap[jj] += *value++;
450 }
451 }
452 } else {
453 for (ii=0; ii<bs; ii++) {
454 for (jj=ii; jj<bs2; jj+=bs) {
455 bap[jj] = *value++;
456 }
457 }
458 }
459 } else {
460 if (is == ADD_VALUES) {
461 for (ii=0; ii<bs; ii++,value+=bs) {
462 for (jj=0; jj<bs; jj++) {
463 bap[jj] += value[jj];
464 }
465 bap += bs;
466 }
467 } else {
468 for (ii=0; ii<bs; ii++,value+=bs) {
469 for (jj=0; jj<bs; jj++) {
470 bap[jj] = value[jj];
471 }
472 bap += bs;
473 }
474 }
475 }
476 goto noinsert2;
477 }
478 }
479 if (nonew == 1) goto noinsert2;
480 if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new global block indexed nonzero block (%D, %D) in the matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),480,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new global block indexed nonzero block (%D, %D) in the matrix"
,orow,ocol)
;
481 MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return
PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,row,col); ierr = PetscMallocA(3,PETSC_FALSE,481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),481,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row
+1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof
(*(new_j))));;do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row
]+nrow+CHUNKSIZE,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]
+nrow+CHUNKSIZE))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[row
]+nrow))*sizeof(*(new_a))));;do {if (__builtin_expect(!!(ierr
),0)) return PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[row]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2*
(ai[row]+nrow))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[row]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[row
]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[row]+nrow+CHUNKSIZE),
aa+bs2*(ai[row]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[row]+nrow
+CHUNKSIZE)))));;do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),481,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row
]; ap = aa + bs2*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE
; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }
;
482 N = nrow++ - 1; high++;
483 /* shift up all the later entries in this row */
484 ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+
1,rp+i,(N-i+1)*sizeof(*(rp+i+1))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),484,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
485 ierr = PetscArraymove(ap+bs2*(i+1),ap+bs2*i,bs2*(N-i+1))((sizeof(*(ap+bs2*(i+1))) != sizeof(*(ap+bs2*i))) || PetscMemmove
(ap+bs2*(i+1),ap+bs2*i,(bs2*(N-i+1))*sizeof(*(ap+bs2*(i+1))))
);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),485,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
486 rp[i] = col;
487 bap = ap + bs2*i;
488 if (roworiented) {
489 for (ii=0; ii<bs; ii++) {
490 for (jj=ii; jj<bs2; jj+=bs) {
491 bap[jj] = *value++;
492 }
493 }
494 } else {
495 for (ii=0; ii<bs; ii++) {
496 for (jj=0; jj<bs; jj++) {
497 *bap++ = *value++;
498 }
499 }
500 }
501 noinsert2:;
502 ailen[row] = nrow;
503 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
504}
505
506/*
507 This routine could be optimized by removing the need for the block copy below and passing stride information
508 to the above inline routines; similarly in MatSetValuesBlocked_MPIBAIJ()
509*/
510PetscErrorCode MatSetValuesBlocked_MPISBAIJ(Mat mat,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const MatScalar v[],InsertMode addv)
511{
512 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
513 const MatScalar *value;
514 MatScalar *barray =baij->barray;
515 PetscBool roworiented = baij->roworiented,ignore_ltriangular = ((Mat_SeqSBAIJ*)baij->A->data)->ignore_ltriangular;
516 PetscErrorCode ierr;
517 PetscInt i,j,ii,jj,row,col,rstart=baij->rstartbs;
518 PetscInt rend=baij->rendbs,cstart=baij->rstartbs,stepval;
519 PetscInt cend=baij->rendbs,bs=mat->rmap->bs,bs2=baij->bs2;
520
521 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 521; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
522 if (!barray) {
523 ierr = PetscMalloc1(bs2,&barray)PetscMallocA(1,PETSC_FALSE,523,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2)*sizeof(**(&barray)),(&barray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),523,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
524 baij->barray = barray;
525 }
526
527 if (roworiented) {
528 stepval = (n-1)*bs;
529 } else {
530 stepval = (m-1)*bs;
531 }
532 for (i=0; i<m; i++) {
533 if (im[i] < 0) continue;
534#if defined(PETSC_USE_DEBUG1)
535 if (im[i] >= baij->Mbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block indexed row too large %D max %D",im[i],baij->Mbs-1)return PetscError(((MPI_Comm)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Block indexed row too large %D max %D"
,im[i],baij->Mbs-1)
;
536#endif
537 if (im[i] >= rstart && im[i] < rend) {
538 row = im[i] - rstart;
539 for (j=0; j<n; j++) {
540 if (im[i] > in[j]) {
541 if (ignore_ltriangular) continue; /* ignore lower triangular blocks */
542 else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),542,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)"
)
;
543 }
544 /* If NumCol = 1 then a copy is not required */
545 if ((roworiented) && (n == 1)) {
546 barray = (MatScalar*) v + i*bs2;
547 } else if ((!roworiented) && (m == 1)) {
548 barray = (MatScalar*) v + j*bs2;
549 } else { /* Here a copy is required */
550 if (roworiented) {
551 value = v + i*(stepval+bs)*bs + j*bs;
552 } else {
553 value = v + j*(stepval+bs)*bs + i*bs;
554 }
555 for (ii=0; ii<bs; ii++,value+=stepval) {
556 for (jj=0; jj<bs; jj++) {
557 *barray++ = *value++;
558 }
559 }
560 barray -=bs2;
561 }
562
563 if (in[j] >= cstart && in[j] < cend) {
564 col = in[j] - cstart;
565 ierr = MatSetValuesBlocked_SeqSBAIJ_Inlined(baij->A,row,col,barray,addv,im[i],in[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),565,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
566 } else if (in[j] < 0) continue;
567#if defined(PETSC_USE_DEBUG1)
568 else if (in[j] >= baij->Nbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block indexed column too large %D max %D",in[j],baij->Nbs-1)return PetscError(((MPI_Comm)0x44000001),568,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Block indexed column too large %D max %D"
,in[j],baij->Nbs-1)
;
569#endif
570 else {
571 if (mat->was_assembled) {
572 if (!baij->colmap) {
573 ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
574 }
575
576#if defined(PETSC_USE_DEBUG1)
577#if defined(PETSC_USE_CTABLE1)
578 { PetscInt data;
579 ierr = PetscTableFind(baij->colmap,in[j]+1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),579,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
580 if ((data - 1) % bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Incorrect colmap")return PetscError(((MPI_Comm)0x44000001),580,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,77,PETSC_ERROR_INITIAL,"Incorrect colmap")
;
581 }
582#else
583 if ((baij->colmap[in[j]] - 1) % bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Incorrect colmap")return PetscError(((MPI_Comm)0x44000001),583,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,77,PETSC_ERROR_INITIAL,"Incorrect colmap")
;
584#endif
585#endif
586#if defined(PETSC_USE_CTABLE1)
587 ierr = PetscTableFind(baij->colmap,in[j]+1,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),587,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
588 col = (col - 1)/bs;
589#else
590 col = (baij->colmap[in[j]] - 1)/bs;
591#endif
592 if (col < 0 && !((Mat_SeqBAIJ*)(baij->A->data))->nonew) {
593 ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),593,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
594 col = in[j];
595 }
596 } else col = in[j];
597 ierr = MatSetValuesBlocked_SeqBAIJ_Inlined(baij->B,row,col,barray,addv,im[i],in[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),597,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
598 }
599 }
600 } else {
601 if (mat->nooffprocentries) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Setting off process block indexed row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set",im[i])return PetscError(((MPI_Comm)0x44000001),601,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Setting off process block indexed row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set"
,im[i])
;
602 if (!baij->donotstash) {
603 if (roworiented) {
604 ierr = MatStashValuesRowBlocked_Private(&mat->bstash,im[i],n,in,v,m,n,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
605 } else {
606 ierr = MatStashValuesColBlocked_Private(&mat->bstash,im[i],n,in,v,m,n,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),606,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
607 }
608 }
609 }
610 }
611 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
612}
613
614PetscErrorCode MatGetValues_MPISBAIJ(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],PetscScalar v[])
615{
616 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
617 PetscErrorCode ierr;
618 PetscInt bs = mat->rmap->bs,i,j,bsrstart = mat->rmap->rstart,bsrend = mat->rmap->rend;
619 PetscInt bscstart = mat->cmap->rstart,bscend = mat->cmap->rend,row,col,data;
620
621 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 621; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
622 for (i=0; i<m; i++) {
1
Assuming 'i' is < 'm'
2
Loop condition is true. Entering loop body
16
Assuming 'i' is < 'm'
17
Loop condition is true. Entering loop body
623 if (idxm[i] < 0) continue; /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row: %D",idxm[i]); */
3
Assuming the condition is false
4
Taking false branch
18
Assuming the condition is false
19
Taking false branch
624 if (idxm[i] >= mat->rmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",idxm[i],mat->rmap->N-1)return PetscError(((MPI_Comm)0x44000001),624,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Row too large: row %D max %D",idxm[i
],mat->rmap->N-1)
;
5
Taking false branch
20
Taking false branch
625 if (idxm[i] >= bsrstart && idxm[i] < bsrend) {
6
Taking true branch
21
Taking true branch
626 row = idxm[i] - bsrstart;
627 for (j=0; j<n; j++) {
7
Assuming 'j' is < 'n'
8
Loop condition is true. Entering loop body
14
Assuming 'j' is >= 'n'
15
Loop condition is false. Execution continues on line 622
22
Loop condition is true. Entering loop body
628 if (idxn[j] < 0) continue; /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column %D",idxn[j]); */
9
Assuming the condition is false
10
Taking false branch
23
Taking false branch
629 if (idxn[j] >= mat->cmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",idxn[j],mat->cmap->N-1)return PetscError(((MPI_Comm)0x44000001),629,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Column too large: col %D max %D",idxn
[j],mat->cmap->N-1)
;
11
Taking false branch
24
Taking false branch
630 if (idxn[j] >= bscstart && idxn[j] < bscend) {
631 col = idxn[j] - bscstart;
632 ierr = MatGetValues_SeqSBAIJ(baij->A,1,&row,1,&col,v+i*n+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
633 } else {
634 if (!baij->colmap) {
12
Assuming the condition is false
13
Taking false branch
25
Taking false branch
635 ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),635,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
636 }
637#if defined(PETSC_USE_CTABLE1)
638 ierr = PetscTableFind(baij->colmap,idxn[j]/bs+1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),638,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
26
Calling 'PetscTableFind'
639 data--;
640#else
641 data = baij->colmap[idxn[j]/bs]-1;
642#endif
643 if ((data < 0) || (baij->garray[data/bs] != idxn[j]/bs)) *(v+i*n+j) = 0.0;
644 else {
645 col = data + idxn[j]%bs;
646 ierr = MatGetValues_SeqBAIJ(baij->B,1,&row,1,&col,v+i*n+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),646,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
647 }
648 }
649 }
650 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only local values currently supported")return PetscError(((MPI_Comm)0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only local values currently supported"
)
;
651 }
652 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
653}
654
655PetscErrorCode MatNorm_MPISBAIJ(Mat mat,NormType type,PetscReal *norm)
656{
657 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
658 PetscErrorCode ierr;
659 PetscReal sum[2],*lnorm2;
660
661 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 661; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
662 if (baij->size == 1) {
663 ierr = MatNorm(baij->A,type,norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),663,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
664 } else {
665 if (type == NORM_FROBENIUS) {
666 ierr = PetscMalloc1(2,&lnorm2)PetscMallocA(1,PETSC_FALSE,666,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(2)*sizeof(**(&lnorm2)),(&lnorm2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),666,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
667 ierr = MatNorm(baij->A,type,lnorm2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),667,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
668 *lnorm2 = (*lnorm2)*(*lnorm2); lnorm2++; /* squar power of norm(A) */
669 ierr = MatNorm(baij->B,type,lnorm2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
670 *lnorm2 = (*lnorm2)*(*lnorm2); lnorm2--; /* squar power of norm(B) */
671 ierr = MPIU_Allreduce(lnorm2,sum,2,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,2,671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((lnorm2),(sum),(2),(
((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003)),(PetscObjectComm
((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
672 *norm = PetscSqrtReal(sum[0] + 2*sum[1])sqrt(sum[0] + 2*sum[1]);
673 ierr = PetscFree(lnorm2)((*PetscTrFree)((void*)(lnorm2),673,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((lnorm2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),673,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
674 } else if (type == NORM_INFINITY || type == NORM_1) { /* max row/column sum */
675 Mat_SeqSBAIJ *amat=(Mat_SeqSBAIJ*)baij->A->data;
676 Mat_SeqBAIJ *bmat=(Mat_SeqBAIJ*)baij->B->data;
677 PetscReal *rsum,*rsum2,vabs;
678 PetscInt *jj,*garray=baij->garray,rstart=baij->rstartbs,nz;
679 PetscInt brow,bcol,col,bs=baij->A->rmap->bs,row,grow,gcol,mbs=amat->mbs;
680 MatScalar *v;
681
682 ierr = PetscMalloc2(mat->cmap->N,&rsum,mat->cmap->N,&rsum2)PetscMallocA(2,PETSC_FALSE,682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(mat->cmap->N)*sizeof(**(&rsum)),(&rsum
),(size_t)(mat->cmap->N)*sizeof(**(&rsum2)),(&rsum2
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
683 ierr = PetscArrayzero(rsum,mat->cmap->N)PetscMemzero(rsum,(mat->cmap->N)*sizeof(*(rsum)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),683,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
684 /* Amat */
685 v = amat->a; jj = amat->j;
686 for (brow=0; brow<mbs; brow++) {
687 grow = bs*(rstart + brow);
688 nz = amat->i[brow+1] - amat->i[brow];
689 for (bcol=0; bcol<nz; bcol++) {
690 gcol = bs*(rstart + *jj); jj++;
691 for (col=0; col<bs; col++) {
692 for (row=0; row<bs; row++) {
693 vabs = PetscAbsScalar(*v); v++;
694 rsum[gcol+col] += vabs;
695 /* non-diagonal block */
696 if (bcol > 0 && vabs > 0.0) rsum[grow+row] += vabs;
697 }
698 }
699 }
700 ierr = PetscLogFlops(nz*bs*bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),700,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
701 }
702 /* Bmat */
703 v = bmat->a; jj = bmat->j;
704 for (brow=0; brow<mbs; brow++) {
705 grow = bs*(rstart + brow);
706 nz = bmat->i[brow+1] - bmat->i[brow];
707 for (bcol=0; bcol<nz; bcol++) {
708 gcol = bs*garray[*jj]; jj++;
709 for (col=0; col<bs; col++) {
710 for (row=0; row<bs; row++) {
711 vabs = PetscAbsScalar(*v); v++;
712 rsum[gcol+col] += vabs;
713 rsum[grow+row] += vabs;
714 }
715 }
716 }
717 ierr = PetscLogFlops(nz*bs*bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),717,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
718 }
719 ierr = MPIU_Allreduce(rsum,rsum2,mat->cmap->N,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,mat->cmap->N,719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((rsum),(rsum2),(mat->
cmap->N),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003
)),(PetscObjectComm((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
720 *norm = 0.0;
721 for (col=0; col<mat->cmap->N; col++) {
722 if (rsum2[col] > *norm) *norm = rsum2[col];
723 }
724 ierr = PetscFree2(rsum,rsum2)PetscFreeA(2,724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(rsum),&(rsum2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
725 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for this norm yet")return PetscError(((MPI_Comm)0x44000001),725,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"No support for this norm yet")
;
726 }
727 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
728}
729
730PetscErrorCode MatAssemblyBegin_MPISBAIJ(Mat mat,MatAssemblyType mode)
731{
732 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
733 PetscErrorCode ierr;
734 PetscInt nstash,reallocs;
735
736 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 736; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
737 if (baij->donotstash || mat->nooffprocentries) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
738
739 ierr = MatStashScatterBegin_Private(mat,&mat->stash,mat->rmap->range);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),739,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
740 ierr = MatStashScatterBegin_Private(mat,&mat->bstash,baij->rangebs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
741 ierr = MatStashGetInfo_Private(&mat->stash,&nstash,&reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),741,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
742 ierr = PetscInfo2(mat,"Stash has %D entries,uses %D mallocs.\n",nstash,reallocs)PetscInfo_Private(__func__,mat,"Stash has %D entries,uses %D mallocs.\n"
,nstash,reallocs)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),742,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
743 ierr = MatStashGetInfo_Private(&mat->stash,&nstash,&reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),743,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
744 ierr = PetscInfo2(mat,"Block-Stash has %D entries, uses %D mallocs.\n",nstash,reallocs)PetscInfo_Private(__func__,mat,"Block-Stash has %D entries, uses %D mallocs.\n"
,nstash,reallocs)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),744,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
745 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
746}
747
748PetscErrorCode MatAssemblyEnd_MPISBAIJ(Mat mat,MatAssemblyType mode)
749{
750 Mat_MPISBAIJ *baij=(Mat_MPISBAIJ*)mat->data;
751 Mat_SeqSBAIJ *a =(Mat_SeqSBAIJ*)baij->A->data;
752 PetscErrorCode ierr;
753 PetscInt i,j,rstart,ncols,flg,bs2=baij->bs2;
754 PetscInt *row,*col;
755 PetscBool other_disassembled;
756 PetscMPIInt n;
757 PetscBool r1,r2,r3;
758 MatScalar *val;
759
760 /* do not use 'b=(Mat_SeqBAIJ*)baij->B->data' as B can be reset in disassembly */
761 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 761; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
762 if (!baij->donotstash && !mat->nooffprocentries) {
763 while (1) {
764 ierr = MatStashScatterGetMesg_Private(&mat->stash,&n,&row,&col,&val,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),764,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
765 if (!flg) break;
766
767 for (i=0; i<n;) {
768 /* Now identify the consecutive vals belonging to the same row */
769 for (j=i,rstart=row[j]; j<n; j++) {
770 if (row[j] != rstart) break;
771 }
772 if (j < n) ncols = j-i;
773 else ncols = n-i;
774 /* Now assemble all these values with a single function call */
775 ierr = MatSetValues_MPISBAIJ(mat,1,row+i,ncols,col+i,val+i,mat->insertmode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),775,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
776 i = j;
777 }
778 }
779 ierr = MatStashScatterEnd_Private(&mat->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),779,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
780 /* Now process the block-stash. Since the values are stashed column-oriented,
781 set the roworiented flag to column oriented, and after MatSetValues()
782 restore the original flags */
783 r1 = baij->roworiented;
784 r2 = a->roworiented;
785 r3 = ((Mat_SeqBAIJ*)baij->B->data)->roworiented;
786
787 baij->roworiented = PETSC_FALSE;
788 a->roworiented = PETSC_FALSE;
789
790 ((Mat_SeqBAIJ*)baij->B->data)->roworiented = PETSC_FALSE; /* b->roworinted */
791 while (1) {
792 ierr = MatStashScatterGetMesg_Private(&mat->bstash,&n,&row,&col,&val,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
793 if (!flg) break;
794
795 for (i=0; i<n;) {
796 /* Now identify the consecutive vals belonging to the same row */
797 for (j=i,rstart=row[j]; j<n; j++) {
798 if (row[j] != rstart) break;
799 }
800 if (j < n) ncols = j-i;
801 else ncols = n-i;
802 ierr = MatSetValuesBlocked_MPISBAIJ(mat,1,row+i,ncols,col+i,val+i*bs2,mat->insertmode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
803 i = j;
804 }
805 }
806 ierr = MatStashScatterEnd_Private(&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),806,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
807
808 baij->roworiented = r1;
809 a->roworiented = r2;
810
811 ((Mat_SeqBAIJ*)baij->B->data)->roworiented = r3; /* b->roworinted */
812 }
813
814 ierr = MatAssemblyBegin(baij->A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),814,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
815 ierr = MatAssemblyEnd(baij->A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),815,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
816
817 /* determine if any processor has disassembled, if so we must
818 also disassemble ourselfs, in order that we may reassemble. */
819 /*
820 if nonzero structure of submatrix B cannot change then we know that
821 no processor disassembled thus we can skip this stuff
822 */
823 if (!((Mat_SeqBAIJ*)baij->B->data)->nonew) {
824 ierr = MPIU_Allreduce(&mat->was_assembled,&other_disassembled,1,MPIU_BOOL,MPI_PROD,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,1,824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((&mat->was_assembled
),(&other_disassembled),(1),(MPIU_BOOL),((MPI_Op)(0x58000004
)),(PetscObjectComm((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
825 if (mat->was_assembled && !other_disassembled) {
826 ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),826,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
827 }
828 }
829
830 if (!mat->was_assembled && mode == MAT_FINAL_ASSEMBLY) {
831 ierr = MatSetUpMultiply_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),831,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* setup Mvctx and sMvctx */
832 }
833 ierr = MatAssemblyBegin(baij->B,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),833,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
834 ierr = MatAssemblyEnd(baij->B,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
835
836 ierr = PetscFree2(baij->rowvalues,baij->rowindices)PetscFreeA(2,836,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(baij->rowvalues),&(baij->rowindices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),836,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
837
838 baij->rowvalues = 0;
839
840 /* if no new nonzero locations are allowed in matrix then only set the matrix state the first time through */
841 if ((!mat->was_assembled && mode == MAT_FINAL_ASSEMBLY) || !((Mat_SeqBAIJ*)(baij->A->data))->nonew) {
842 PetscObjectState state = baij->A->nonzerostate + baij->B->nonzerostate;
843 ierr = MPIU_Allreduce(&state,&mat->nonzerostate,1,MPIU_INT64,MPI_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,1,843,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((&state),(&mat
->nonzerostate),(1),(((MPI_Datatype)0x4c00083a)),((MPI_Op)
(0x58000003)),(PetscObjectComm((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),843,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
844 }
845 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
846}
847
848extern PetscErrorCode MatSetValues_MPIBAIJ(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
849#include <petscdraw.h>
850static PetscErrorCode MatView_MPISBAIJ_ASCIIorDraworSocket(Mat mat,PetscViewer viewer)
851{
852 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
853 PetscErrorCode ierr;
854 PetscInt bs = mat->rmap->bs;
855 PetscMPIInt rank = baij->rank;
856 PetscBool iascii,isdraw;
857 PetscViewer sviewer;
858 PetscViewerFormat format;
859
860 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 860; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
861 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
862 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
863 if (iascii) {
864 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
865 if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
866 MatInfo info;
867 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
868 ierr = MatGetInfo(mat,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),868,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
869 ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
870 ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] Local rows %D nz %D nz alloced %D bs %D mem %g\n",rank,mat->rmap->n,(PetscInt)info.nz_used,(PetscInt)info.nz_allocated,mat->rmap->bs,(double)info.memory);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),870,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
871 ierr = MatGetInfo(baij->A,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),871,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
872 ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] on-diagonal part: nz %D \n",rank,(PetscInt)info.nz_used);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),872,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
873 ierr = MatGetInfo(baij->B,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),873,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
874 ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] off-diagonal part: nz %D \n",rank,(PetscInt)info.nz_used);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),874,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
875 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),875,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
876 ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),876,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
877 ierr = PetscViewerASCIIPrintf(viewer,"Information on VecScatter used in matrix-vector product: \n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
878 ierr = VecScatterView(baij->Mvctx,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),878,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
879 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
880 } else if (format == PETSC_VIEWER_ASCII_INFO) {
881 ierr = PetscViewerASCIIPrintf(viewer," block size is %D\n",bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),881,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
882 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
883 } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO) {
884 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
885 }
886 }
887
888 if (isdraw) {
889 PetscDraw draw;
890 PetscBool isnull;
891 ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),891,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
892 ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),892,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
893 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)
;
894 }
895
896 {
897 /* assemble the entire matrix onto first processor. */
898 Mat A;
899 Mat_SeqSBAIJ *Aloc;
900 Mat_SeqBAIJ *Bloc;
901 PetscInt M = mat->rmap->N,N = mat->cmap->N,*ai,*aj,col,i,j,k,*rvals,mbs = baij->mbs;
902 MatScalar *a;
903 const char *matname;
904
905 /* Should this be the same type as mat? */
906 ierr = MatCreate(PetscObjectComm((PetscObject)mat),&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
907 if (!rank) {
908 ierr = MatSetSizes(A,M,N,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),908,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
909 } else {
910 ierr = MatSetSizes(A,0,0,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),910,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
911 }
912 ierr = MatSetType(A,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
913 ierr = MatMPISBAIJSetPreallocation(A,mat->rmap->bs,0,NULL((void*)0),0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),913,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
914 ierr = MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),914,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
915 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
916
917 /* copy over the A part */
918 Aloc = (Mat_SeqSBAIJ*)baij->A->data;
919 ai = Aloc->i; aj = Aloc->j; a = Aloc->a;
920 ierr = PetscMalloc1(bs,&rvals)PetscMallocA(1,PETSC_FALSE,920,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs)*sizeof(**(&rvals)),(&rvals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),920,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
921
922 for (i=0; i<mbs; i++) {
923 rvals[0] = bs*(baij->rstartbs + i);
924 for (j=1; j<bs; j++) rvals[j] = rvals[j-1] + 1;
925 for (j=ai[i]; j<ai[i+1]; j++) {
926 col = (baij->cstartbs+aj[j])*bs;
927 for (k=0; k<bs; k++) {
928 ierr = MatSetValues_MPISBAIJ(A,bs,rvals,1,&col,a,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),928,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
929 col++;
930 a += bs;
931 }
932 }
933 }
934 /* copy over the B part */
935 Bloc = (Mat_SeqBAIJ*)baij->B->data;
936 ai = Bloc->i; aj = Bloc->j; a = Bloc->a;
937 for (i=0; i<mbs; i++) {
938
939 rvals[0] = bs*(baij->rstartbs + i);
940 for (j=1; j<bs; j++) rvals[j] = rvals[j-1] + 1;
941 for (j=ai[i]; j<ai[i+1]; j++) {
942 col = baij->garray[aj[j]]*bs;
943 for (k=0; k<bs; k++) {
944 ierr = MatSetValues_MPIBAIJ(A,bs,rvals,1,&col,a,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),944,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
945 col++;
946 a += bs;
947 }
948 }
949 }
950 ierr = PetscFree(rvals)((*PetscTrFree)((void*)(rvals),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((rvals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
951 ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),951,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
952 ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),952,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
953 /*
954 Everyone has to call to draw the matrix since the graphics waits are
955 synchronized across all processors that share the PetscDraw object
956 */
957 ierr = PetscViewerGetSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),957,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
958 ierr = PetscObjectGetName((PetscObject)mat,&matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),958,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
959 if (!rank) {
960 ierr = PetscObjectSetName((PetscObject)((Mat_MPISBAIJ*)(A->data))->A,matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),960,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
961 ierr = MatView_SeqSBAIJ(((Mat_MPISBAIJ*)(A->data))->A,sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),961,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
962 }
963 ierr = PetscViewerRestoreSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),963,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
964 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),964,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
965 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
966 }
967 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
968}
969
970static PetscErrorCode MatView_MPISBAIJ_Binary(Mat mat,PetscViewer viewer)
971{
972 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)mat->data;
973 Mat_SeqSBAIJ *A = (Mat_SeqSBAIJ*)a->A->data;
974 Mat_SeqBAIJ *B = (Mat_SeqBAIJ*)a->B->data;
975 PetscErrorCode ierr;
976 PetscInt i,*row_lens,*crow_lens,bs = mat->rmap->bs,j,k,bs2=a->bs2,header[4],nz,rlen;
977 PetscInt *range=0,nzmax,*column_indices,cnt,col,*garray = a->garray,cstart = mat->cmap->rstart/bs,len,pcnt,l,ll;
978 int fd;
979 PetscScalar *column_values;
980 FILE *file;
981 PetscMPIInt rank,size,tag = ((PetscObject)viewer)->tag;
982 PetscInt message_count,flowcontrolcount;
983
984 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 984; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
985 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),985,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
986 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)mat),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
987 nz = bs2*(A->nz + B->nz);
988 rlen = mat->rmap->n;
989 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),989,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
990 if (!rank) {
991 header[0] = MAT_FILE_CLASSID1211216;
992 header[1] = mat->rmap->N;
993 header[2] = mat->cmap->N;
994
995 ierr = MPI_Reduce(&nz,&header[3],1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),995,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
996 ierr = PetscBinaryWrite(fd,header,4,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
997 /* get largest number of rows any processor has */
998 range = mat->rmap->range;
999 for (i=1; i<size; i++) {
1000 rlen = PetscMax(rlen,range[i+1] - range[i])(((rlen)<(range[i+1] - range[i])) ? (range[i+1] - range[i]
) : (rlen))
;
1001 }
1002 } else {
1003 ierr = MPI_Reduce(&nz,0,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1003,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1004 }
1005
1006 ierr = PetscMalloc1(rlen/bs,&crow_lens)PetscMallocA(1,PETSC_FALSE,1006,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(rlen/bs)*sizeof(**(&crow_lens)),(&crow_lens
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1006,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1007 /* compute lengths of each row */
1008 for (i=0; i<a->mbs; i++) {
1009 crow_lens[i] = A->i[i+1] - A->i[i] + B->i[i+1] - B->i[i];
1010 }
1011 /* store the row lengths to the file */
1012 ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1012,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1013 if (!rank) {
1014 MPI_Status status;
1015 ierr = PetscMalloc1(rlen,&row_lens)PetscMallocA(1,PETSC_FALSE,1015,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(rlen)*sizeof(**(&row_lens)),(&row_lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1015,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1016 rlen = (range[1] - range[0])/bs;
1017 for (i=0; i<rlen; i++) {
1018 for (j=0; j<bs; j++) {
1019 row_lens[i*bs+j] = bs*crow_lens[i];
1020 }
1021 }
1022 ierr = PetscBinaryWrite(fd,row_lens,bs*rlen,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1022,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1023 for (i=1; i<size; i++) {
1024 rlen = (range[i+1] - range[i])/bs;
1025 ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1025,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1026 ierr = MPI_Recv(crow_lens,rlen,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((rlen),(((MPI_Datatype
)0x4c000405)),(&petsc_recv_len)) || MPI_Recv((crow_lens),
(rlen),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm
((PetscObject)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1026,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1027 for (k=0; k<rlen; k++) {
1028 for (j=0; j<bs; j++) {
1029 row_lens[k*bs+j] = bs*crow_lens[k];
1030 }
1031 }
1032 ierr = PetscBinaryWrite(fd,row_lens,bs*rlen,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1033 }
1034 ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1034,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1035 ierr = PetscFree(row_lens)((*PetscTrFree)((void*)(row_lens),1035,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((row_lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1035,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1036 } else {
1037 ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1037,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1038 ierr = MPI_Send(crow_lens,mat->rmap->n/bs,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((mat->rmap->n/
bs),(((MPI_Datatype)0x4c000405)),(&petsc_send_len)) || MPI_Send
((crow_lens),(mat->rmap->n/bs),(((MPI_Datatype)0x4c000405
)),(0),(tag),(PetscObjectComm((PetscObject)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1038,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1039 ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1039,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1040 }
1041 ierr = PetscFree(crow_lens)((*PetscTrFree)((void*)(crow_lens),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((crow_lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1042
1043 /* load up the local column indices. Include for all rows not just one for each block row since process 0 does not have the
1044 information needed to make it for each row from a block row. This does require more communication but still not more than
1045 the communication needed for the nonzero values */
1046 nzmax = nz; /* space a largest processor needs */
1047 ierr = MPI_Reduce(&nz,&nzmax,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_MAX(MPI_Op)(0x58000001),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1047,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1048 ierr = PetscMalloc1(nzmax,&column_indices)PetscMallocA(1,PETSC_FALSE,1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(nzmax)*sizeof(**(&column_indices)),(&column_indices
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1049 cnt = 0;
1050 for (i=0; i<a->mbs; i++) {
1051 pcnt = cnt;
1052 for (j=B->i[i]; j<B->i[i+1]; j++) {
1053 if ((col = garray[B->j[j]]) > cstart) break;
1054 for (l=0; l<bs; l++) {
1055 column_indices[cnt++] = bs*col+l;
1056 }
1057 }
1058 for (k=A->i[i]; k<A->i[i+1]; k++) {
1059 for (l=0; l<bs; l++) {
1060 column_indices[cnt++] = bs*(A->j[k] + cstart)+l;
1061 }
1062 }
1063 for (; j<B->i[i+1]; j++) {
1064 for (l=0; l<bs; l++) {
1065 column_indices[cnt++] = bs*garray[B->j[j]]+l;
1066 }
1067 }
1068 len = cnt - pcnt;
1069 for (k=1; k<bs; k++) {
1070 ierr = PetscArraycpy(&column_indices[cnt],&column_indices[pcnt],len)((sizeof(*(&column_indices[cnt])) != sizeof(*(&column_indices
[pcnt]))) || PetscMemcpy(&column_indices[cnt],&column_indices
[pcnt],(len)*sizeof(*(&column_indices[cnt]))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1070,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1071 cnt += len;
1072 }
1073 }
1074 if (cnt != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"Internal PETSc error: cnt = %D nz = %D",cnt,nz)return PetscError(((MPI_Comm)0x44000001),1074,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,76,PETSC_ERROR_INITIAL,"Internal PETSc error: cnt = %D nz = %D"
,cnt,nz)
;
1075
1076 /* store the columns to the file */
1077 ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1077,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1078 if (!rank) {
1079 MPI_Status status;
1080 ierr = PetscBinaryWrite(fd,column_indices,nz,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1080,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1081 for (i=1; i<size; i++) {
1082 ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1082,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1083 ierr = MPI_Recv(&cnt,1,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_recv_len)) || MPI_Recv((&cnt),(1
),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm((PetscObject
)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1083,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1084 ierr = MPI_Recv(column_indices,cnt,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((cnt),(((MPI_Datatype
)0x4c000405)),(&petsc_recv_len)) || MPI_Recv((column_indices
),(cnt),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm
((PetscObject)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1084,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1085 ierr = PetscBinaryWrite(fd,column_indices,cnt,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1086 }
1087 ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1087,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1088 } else {
1089 ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1089,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1090 ierr = MPI_Send(&cnt,1,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_send_len)) || MPI_Send((&cnt),(1
),(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm((PetscObject
)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1090,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1091 ierr = MPI_Send(column_indices,cnt,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((cnt),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Send((column_indices
),(cnt),(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm
((PetscObject)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1091,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1092 ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1092,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1093 }
1094 ierr = PetscFree(column_indices)((*PetscTrFree)((void*)(column_indices),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((column_indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1095
1096 /* load up the numerical values */
1097 ierr = PetscMalloc1(nzmax,&column_values)PetscMallocA(1,PETSC_FALSE,1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(nzmax)*sizeof(**(&column_values)),(&column_values
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1098 cnt = 0;
1099 for (i=0; i<a->mbs; i++) {
1100 rlen = bs*(B->i[i+1] - B->i[i] + A->i[i+1] - A->i[i]);
1101 for (j=B->i[i]; j<B->i[i+1]; j++) {
1102 if (garray[B->j[j]] > cstart) break;
1103 for (l=0; l<bs; l++) {
1104 for (ll=0; ll<bs; ll++) {
1105 column_values[cnt + l*rlen + ll] = B->a[bs2*j+l+bs*ll];
1106 }
1107 }
1108 cnt += bs;
1109 }
1110 for (k=A->i[i]; k<A->i[i+1]; k++) {
1111 for (l=0; l<bs; l++) {
1112 for (ll=0; ll<bs; ll++) {
1113 column_values[cnt + l*rlen + ll] = A->a[bs2*k+l+bs*ll];
1114 }
1115 }
1116 cnt += bs;
1117 }
1118 for (; j<B->i[i+1]; j++) {
1119 for (l=0; l<bs; l++) {
1120 for (ll=0; ll<bs; ll++) {
1121 column_values[cnt + l*rlen + ll] = B->a[bs2*j+l+bs*ll];
1122 }
1123 }
1124 cnt += bs;
1125 }
1126 cnt += (bs-1)*rlen;
1127 }
1128 if (cnt != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Internal PETSc error: cnt = %D nz = %D",cnt,nz)return PetscError(((MPI_Comm)0x44000001),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,77,PETSC_ERROR_INITIAL,"Internal PETSc error: cnt = %D nz = %D"
,cnt,nz)
;
1129
1130 /* store the column values to the file */
1131 ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1132 if (!rank) {
1133 MPI_Status status;
1134 ierr = PetscBinaryWrite(fd,column_values,nz,PETSC_SCALARPETSC_DOUBLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1134,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1135 for (i=1; i<size; i++) {
1136 ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1136,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1137 ierr = MPI_Recv(&cnt,1,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_recv_len)) || MPI_Recv((&cnt),(1
),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm((PetscObject
)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1137,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1138 ierr = MPI_Recv(column_values,cnt,MPIU_SCALAR,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((cnt),(((MPI_Datatype
)0x4c00080b)),(&petsc_recv_len)) || MPI_Recv((column_values
),(cnt),(((MPI_Datatype)0x4c00080b)),(i),(tag),(PetscObjectComm
((PetscObject)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1139 ierr = PetscBinaryWrite(fd,column_values,cnt,PETSC_SCALARPETSC_DOUBLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1140 }
1141 ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1141,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1142 } else {
1143 ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1143,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1144 ierr = MPI_Send(&nz,1,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_send_len)) || MPI_Send((&nz),(1)
,(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm((PetscObject
)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1144,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1145 ierr = MPI_Send(column_values,nz,MPIU_SCALAR,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((nz),(((MPI_Datatype
)0x4c00080b)),(&petsc_send_len)) || MPI_Send((column_values
),(nz),(((MPI_Datatype)0x4c00080b)),(0),(tag),(PetscObjectComm
((PetscObject)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1145,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1146 ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1147 }
1148 ierr = PetscFree(column_values)((*PetscTrFree)((void*)(column_values),1148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((column_values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1149
1150 ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1150,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1151 if (file) {
1152 fprintf(file,"-matload_block_size %d\n",(int)mat->rmap->bs);
1153 }
1154 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1155}
1156
1157PetscErrorCode MatView_MPISBAIJ(Mat mat,PetscViewer viewer)
1158{
1159 PetscErrorCode ierr;
1160 PetscBool iascii,isdraw,issocket,isbinary;
1161
1162 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1162; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1163 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1164 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1165 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSOCKET"socket",&issocket);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1166 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1166,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1167 if (iascii || isdraw || issocket) {
1168 ierr = MatView_MPISBAIJ_ASCIIorDraworSocket(mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1169 } else if (isbinary) {
1170 ierr = MatView_MPISBAIJ_Binary(mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1170,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1171 }
1172 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1173}
1174
1175PetscErrorCode MatDestroy_MPISBAIJ(Mat mat)
1176{
1177 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1178 PetscErrorCode ierr;
1179
1180 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1180; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1181#if defined(PETSC_USE_LOG1)
1182 PetscLogObjectState((PetscObject)mat,"Rows=%D,Cols=%D",mat->rmap->N,mat->cmap->N);
1183#endif
1184 ierr = MatStashDestroy_Private(&mat->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1184,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1185 ierr = MatStashDestroy_Private(&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1185,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1186 ierr = MatDestroy(&baij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1186,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1187 ierr = MatDestroy(&baij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1187,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1188#if defined(PETSC_USE_CTABLE1)
1189 ierr = PetscTableDestroy(&baij->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1189,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1190#else
1191 ierr = PetscFree(baij->colmap)((*PetscTrFree)((void*)(baij->colmap),1191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->colmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1192#endif
1193 ierr = PetscFree(baij->garray)((*PetscTrFree)((void*)(baij->garray),1193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->garray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1194 ierr = VecDestroy(&baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1194,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1195 ierr = VecScatterDestroy(&baij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1195,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1196 ierr = VecDestroy(&baij->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1197 ierr = VecDestroy(&baij->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1197,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1198 ierr = VecDestroy(&baij->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1199 ierr = VecDestroy(&baij->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1200 ierr = VecDestroy(&baij->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1201 ierr = VecScatterDestroy(&baij->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1202 ierr = PetscFree2(baij->rowvalues,baij->rowindices)PetscFreeA(2,1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(baij->rowvalues),&(baij->rowindices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1203 ierr = PetscFree(baij->barray)((*PetscTrFree)((void*)(baij->barray),1203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->barray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1204 ierr = PetscFree(baij->hd)((*PetscTrFree)((void*)(baij->hd),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->hd) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1205 ierr = VecDestroy(&baij->diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1206 ierr = VecDestroy(&baij->bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1207 ierr = VecDestroy(&baij->xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1207,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1208#if defined(PETSC_USE_REAL_MAT_SINGLE)
1209 ierr = PetscFree(baij->setvaluescopy)((*PetscTrFree)((void*)(baij->setvaluescopy),1209,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->setvaluescopy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1210#endif
1211 ierr = PetscFree(baij->in_loc)((*PetscTrFree)((void*)(baij->in_loc),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->in_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1212 ierr = PetscFree(baij->v_loc)((*PetscTrFree)((void*)(baij->v_loc),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->v_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1213 ierr = PetscFree(baij->rangebs)((*PetscTrFree)((void*)(baij->rangebs),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->rangebs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1214 ierr = PetscFree(mat->data)((*PetscTrFree)((void*)(mat->data),1214,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((mat->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1214,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1215
1216 ierr = PetscObjectChangeTypeName((PetscObject)mat,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1217 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatStoreValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatStoreValues_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1218 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatRetrieveValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatRetrieveValues_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1219 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatMPISBAIJSetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatMPISBAIJSetPreallocation_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1220#if defined(PETSC_HAVE_ELEMENTAL)
1221 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_elemental_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_elemental_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1222#endif
1223 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_mpiaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_mpiaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1224 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_mpibaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_mpibaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1224,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1225 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1226}
1227
1228PetscErrorCode MatMult_MPISBAIJ_Hermitian(Mat A,Vec xx,Vec yy)
1229{
1230 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1231 PetscErrorCode ierr;
1232 PetscInt nt,mbs=a->mbs,bs=A->rmap->bs;
1233 PetscScalar *from;
1234 const PetscScalar *x;
1235
1236 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1236; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1237 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1237,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1238 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1239
1240 /* diagonal part */
1241 ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1241,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1242 ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1243
1244 /* subdiagonal part */
1245 ierr = (*a->B->ops->multhermitiantranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1245,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1246
1247 /* copy x into the vec slvec0 */
1248 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1248,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1249 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1249,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1250
1251 ierr = PetscArraycpy(from,x,bs*mbs)((sizeof(*(from)) != sizeof(*(x))) || PetscMemcpy(from,x,(bs*
mbs)*sizeof(*(from))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1251,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1252 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1252,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1253 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1253,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1254
1255 ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1255,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1256 ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1257 /* supperdiagonal part */
1258 ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1259 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1260}
1261
1262PetscErrorCode MatMult_MPISBAIJ(Mat A,Vec xx,Vec yy)
1263{
1264 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1265 PetscErrorCode ierr;
1266 PetscInt nt,mbs=a->mbs,bs=A->rmap->bs;
1267 PetscScalar *from;
1268 const PetscScalar *x;
1269
1270 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1270; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1271 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1272 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1273
1274 /* diagonal part */
1275 ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1275,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1276 ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1277
1278 /* subdiagonal part */
1279 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1279,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1280
1281 /* copy x into the vec slvec0 */
1282 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1282,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1283 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1283,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1284
1285 ierr = PetscArraycpy(from,x,bs*mbs)((sizeof(*(from)) != sizeof(*(x))) || PetscMemcpy(from,x,(bs*
mbs)*sizeof(*(from))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1286 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1287 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1288
1289 ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1289,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1290 ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1290,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1291 /* supperdiagonal part */
1292 ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1292,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1293 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1294}
1295
1296PetscErrorCode MatMult_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy)
1297{
1298 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1299 PetscErrorCode ierr;
1300 PetscInt nt;
1301
1302 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1302; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1303 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1303,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1304 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1305
1306 ierr = VecGetLocalSize(yy,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1306,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1307 if (nt != A->rmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible parition of A and yy")return PetscError(((MPI_Comm)0x44000001),1307,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible parition of A and yy")
;
1308
1309 ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1309,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1310 /* do diagonal part */
1311 ierr = (*a->A->ops->mult)(a->A,xx,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1311,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1312 /* do supperdiagonal part */
1313 ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1313,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1314 ierr = (*a->B->ops->multadd)(a->B,a->lvec,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1314,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1315 /* do subdiagonal part */
1316 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1316,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1317 ierr = VecScatterBegin(a->Mvctx,a->lvec,yy,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1318 ierr = VecScatterEnd(a->Mvctx,a->lvec,yy,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1319 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1320}
1321
1322PetscErrorCode MatMultAdd_MPISBAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1323{
1324 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1325 PetscErrorCode ierr;
1326 PetscInt mbs=a->mbs,bs=A->rmap->bs;
1327 PetscScalar *from,zero=0.0;
1328 const PetscScalar *x;
1329
1330 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1330; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1331 /*
1332 PetscSynchronizedPrintf(PetscObjectComm((PetscObject)A)," MatMultAdd is called ...\n");
1333 PetscSynchronizedFlush(PetscObjectComm((PetscObject)A),PETSC_STDOUT);
1334 */
1335 /* diagonal part */
1336 ierr = (*a->A->ops->multadd)(a->A,xx,yy,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1337 ierr = VecSet(a->slvec1b,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1337,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1338
1339 /* subdiagonal part */
1340 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1341
1342 /* copy x into the vec slvec0 */
1343 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1343,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1344 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1344,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1345 ierr = PetscArraycpy(from,x,bs*mbs)((sizeof(*(from)) != sizeof(*(x))) || PetscMemcpy(from,x,(bs*
mbs)*sizeof(*(from))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1345,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1346 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1346,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1347
1348 ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1348,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1349 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1349,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1350 ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1351
1352 /* supperdiagonal part */
1353 ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1354 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1355}
1356
1357PetscErrorCode MatMultAdd_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy,Vec zz)
1358{
1359 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1360 PetscErrorCode ierr;
1361
1362 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1362; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1363 ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1364 /* do diagonal part */
1365 ierr = (*a->A->ops->multadd)(a->A,xx,yy,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1365,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1366 /* do supperdiagonal part */
1367 ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1367,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1368 ierr = (*a->B->ops->multadd)(a->B,a->lvec,zz,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1368,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1369
1370 /* do subdiagonal part */
1371 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1371,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1372 ierr = VecScatterBegin(a->Mvctx,a->lvec,zz,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1372,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1373 ierr = VecScatterEnd(a->Mvctx,a->lvec,zz,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1373,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} 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/*
1378 This only works correctly for square matrices where the subblock A->A is the
1379 diagonal block
1380*/
1381PetscErrorCode MatGetDiagonal_MPISBAIJ(Mat A,Vec v)
1382{
1383 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1384 PetscErrorCode ierr;
1385
1386 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1386; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1387 /* if (a->rmap->N != a->cmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Supports only square matrix where A->A is diag block"); */
1388 ierr = MatGetDiagonal(a->A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1388,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1389 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1390}
1391
1392PetscErrorCode MatScale_MPISBAIJ(Mat A,PetscScalar aa)
1393{
1394 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1395 PetscErrorCode ierr;
1396
1397 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1397; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1398 ierr = MatScale(a->A,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1398,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1399 ierr = MatScale(a->B,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1399,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1400 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1401}
1402
1403PetscErrorCode MatGetRow_MPISBAIJ(Mat matin,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1404{
1405 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
1406 PetscScalar *vworkA,*vworkB,**pvA,**pvB,*v_p;
1407 PetscErrorCode ierr;
1408 PetscInt bs = matin->rmap->bs,bs2 = mat->bs2,i,*cworkA,*cworkB,**pcA,**pcB;
1409 PetscInt nztot,nzA,nzB,lrow,brstart = matin->rmap->rstart,brend = matin->rmap->rend;
1410 PetscInt *cmap,*idx_p,cstart = mat->rstartbs;
1411
1412 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1412; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1413 if (mat->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Already active")return PetscError(((MPI_Comm)0x44000001),1413,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Already active")
;
1414 mat->getrowactive = PETSC_TRUE;
1415
1416 if (!mat->rowvalues && (idx || v)) {
1417 /*
1418 allocate enough space to hold information from the longest row.
1419 */
1420 Mat_SeqSBAIJ *Aa = (Mat_SeqSBAIJ*)mat->A->data;
1421 Mat_SeqBAIJ *Ba = (Mat_SeqBAIJ*)mat->B->data;
1422 PetscInt max = 1,mbs = mat->mbs,tmp;
1423 for (i=0; i<mbs; i++) {
1424 tmp = Aa->i[i+1] - Aa->i[i] + Ba->i[i+1] - Ba->i[i]; /* row length */
1425 if (max < tmp) max = tmp;
1426 }
1427 ierr = PetscMalloc2(max*bs2,&mat->rowvalues,max*bs2,&mat->rowindices)PetscMallocA(2,PETSC_FALSE,1427,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(max*bs2)*sizeof(**(&mat->rowvalues)),(&mat
->rowvalues),(size_t)(max*bs2)*sizeof(**(&mat->rowindices
)),(&mat->rowindices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1427,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1428 }
1429
1430 if (row < brstart || row >= brend) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only local rows")return PetscError(((MPI_Comm)0x44000001),1430,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only local rows")
;
1431 lrow = row - brstart; /* local row index */
1432
1433 pvA = &vworkA; pcA = &cworkA; pvB = &vworkB; pcB = &cworkB;
1434 if (!v) {pvA = 0; pvB = 0;}
1435 if (!idx) {pcA = 0; if (!v) pcB = 0;}
1436 ierr = (*mat->A->ops->getrow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1436,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1437 ierr = (*mat->B->ops->getrow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1437,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1438 nztot = nzA + nzB;
1439
1440 cmap = mat->garray;
1441 if (v || idx) {
1442 if (nztot) {
1443 /* Sort by increasing column numbers, assuming A and B already sorted */
1444 PetscInt imark = -1;
1445 if (v) {
1446 *v = v_p = mat->rowvalues;
1447 for (i=0; i<nzB; i++) {
1448 if (cmap[cworkB[i]/bs] < cstart) v_p[i] = vworkB[i];
1449 else break;
1450 }
1451 imark = i;
1452 for (i=0; i<nzA; i++) v_p[imark+i] = vworkA[i];
1453 for (i=imark; i<nzB; i++) v_p[nzA+i] = vworkB[i];
1454 }
1455 if (idx) {
1456 *idx = idx_p = mat->rowindices;
1457 if (imark > -1) {
1458 for (i=0; i<imark; i++) {
1459 idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs;
1460 }
1461 } else {
1462 for (i=0; i<nzB; i++) {
1463 if (cmap[cworkB[i]/bs] < cstart) idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs;
1464 else break;
1465 }
1466 imark = i;
1467 }
1468 for (i=0; i<nzA; i++) idx_p[imark+i] = cstart*bs + cworkA[i];
1469 for (i=imark; i<nzB; i++) idx_p[nzA+i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs ;
1470 }
1471 } else {
1472 if (idx) *idx = 0;
1473 if (v) *v = 0;
1474 }
1475 }
1476 *nz = nztot;
1477 ierr = (*mat->A->ops->restorerow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1477,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1478 ierr = (*mat->B->ops->restorerow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1478,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1479 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1480}
1481
1482PetscErrorCode MatRestoreRow_MPISBAIJ(Mat mat,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1483{
1484 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1485
1486 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1486; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1487 if (!baij->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"MatGetRow() must be called first")return PetscError(((MPI_Comm)0x44000001),1487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"MatGetRow() must be called first")
;
1488 baij->getrowactive = PETSC_FALSE;
1489 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1490}
1491
1492PetscErrorCode MatGetRowUpperTriangular_MPISBAIJ(Mat A)
1493{
1494 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1495 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1496
1497 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1497; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1498 aA->getrow_utriangular = PETSC_TRUE;
1499 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1500}
1501PetscErrorCode MatRestoreRowUpperTriangular_MPISBAIJ(Mat A)
1502{
1503 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1504 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1505
1506 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1506; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1507 aA->getrow_utriangular = PETSC_FALSE;
1508 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1509}
1510
1511PetscErrorCode MatRealPart_MPISBAIJ(Mat A)
1512{
1513 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1514 PetscErrorCode ierr;
1515
1516 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1516; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1517 ierr = MatRealPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1517,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1518 ierr = MatRealPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1518,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1519 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1520}
1521
1522PetscErrorCode MatImaginaryPart_MPISBAIJ(Mat A)
1523{
1524 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1525 PetscErrorCode ierr;
1526
1527 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1527; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1528 ierr = MatImaginaryPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1528,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1529 ierr = MatImaginaryPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1529,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1530 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1531}
1532
1533/* Check if isrow is a subset of iscol_local, called by MatCreateSubMatrix_MPISBAIJ()
1534 Input: isrow - distributed(parallel),
1535 iscol_local - locally owned (seq)
1536*/
1537PetscErrorCode ISEqual_private(IS isrow,IS iscol_local,PetscBool *flg)
1538{
1539 PetscErrorCode ierr;
1540 PetscInt sz1,sz2,*a1,*a2,i,j,k,nmatch;
1541 const PetscInt *ptr1,*ptr2;
1542
1543 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1543; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1544 ierr = ISGetLocalSize(isrow,&sz1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1544,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1545 ierr = ISGetLocalSize(iscol_local,&sz2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1545,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1546 if (sz1 > sz2) {
1547 *flg = PETSC_FALSE;
1548 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1549 }
1550
1551 ierr = ISGetIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1551,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1552 ierr = ISGetIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1552,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1553
1554 ierr = PetscMalloc1(sz1,&a1)PetscMallocA(1,PETSC_FALSE,1554,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(sz1)*sizeof(**(&a1)),(&a1))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1554,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1555 ierr = PetscMalloc1(sz2,&a2)PetscMallocA(1,PETSC_FALSE,1555,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(sz2)*sizeof(**(&a2)),(&a2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1555,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1556 ierr = PetscArraycpy(a1,ptr1,sz1)((sizeof(*(a1)) != sizeof(*(ptr1))) || PetscMemcpy(a1,ptr1,(sz1
)*sizeof(*(a1))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1556,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1557 ierr = PetscArraycpy(a2,ptr2,sz2)((sizeof(*(a2)) != sizeof(*(ptr2))) || PetscMemcpy(a2,ptr2,(sz2
)*sizeof(*(a2))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1557,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1558 ierr = PetscSortInt(sz1,a1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1558,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1559 ierr = PetscSortInt(sz2,a2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1559,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1560
1561 nmatch=0;
1562 k = 0;
1563 for (i=0; i<sz1; i++){
1564 for (j=k; j<sz2; j++){
1565 if (a1[i] == a2[j]) {
1566 k = j; nmatch++;
1567 break;
1568 }
1569 }
1570 }
1571 ierr = ISRestoreIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1571,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1572 ierr = ISRestoreIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1573 ierr = PetscFree(a1)((*PetscTrFree)((void*)(a1),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((a1) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1574 ierr = PetscFree(a2)((*PetscTrFree)((void*)(a2),1574,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((a2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1574,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1575 if (nmatch < sz1) {
1576 *flg = PETSC_FALSE;
1577 } else {
1578 *flg = PETSC_TRUE;
1579 }
1580 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1581}
1582
1583PetscErrorCode MatCreateSubMatrix_MPISBAIJ(Mat mat,IS isrow,IS iscol,MatReuse call,Mat *newmat)
1584{
1585 PetscErrorCode ierr;
1586 IS iscol_local;
1587 PetscInt csize;
1588 PetscBool isequal;
1589
1590 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1590; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1591 ierr = ISGetLocalSize(iscol,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1591,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1592 if (call == MAT_REUSE_MATRIX) {
1593 ierr = PetscObjectQuery((PetscObject)*newmat,"ISAllGather",(PetscObject*)&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1593,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1594 if (!iscol_local) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Submatrix passed in was not used before, cannot reuse")return PetscError(((MPI_Comm)0x44000001),1594,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Submatrix passed in was not used before, cannot reuse"
)
;
1595 } else {
1596 ierr = ISAllGather(iscol,&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1596,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1597 ierr = ISEqual_private(isrow,iscol_local,&isequal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1597,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1598 if (!isequal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"For symmetric format, iscol must equal isrow")return PetscError(((MPI_Comm)0x44000001),1598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,75,PETSC_ERROR_INITIAL,"For symmetric format, iscol must equal isrow"
)
;
1599 }
1600
1601 /* now call MatCreateSubMatrix_MPIBAIJ() */
1602 ierr = MatCreateSubMatrix_MPIBAIJ_Private(mat,isrow,iscol_local,csize,call,newmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1602,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1603 if (call == MAT_INITIAL_MATRIX) {
1604 ierr = PetscObjectCompose((PetscObject)*newmat,"ISAllGather",(PetscObject)iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1605 ierr = ISDestroy(&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1605,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1606 }
1607 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1608}
1609
1610PetscErrorCode MatZeroEntries_MPISBAIJ(Mat A)
1611{
1612 Mat_MPISBAIJ *l = (Mat_MPISBAIJ*)A->data;
1613 PetscErrorCode ierr;
1614
1615 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1615; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1616 ierr = MatZeroEntries(l->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1616,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1617 ierr = MatZeroEntries(l->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1618 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1619}
1620
1621PetscErrorCode MatGetInfo_MPISBAIJ(Mat matin,MatInfoType flag,MatInfo *info)
1622{
1623 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)matin->data;
1624 Mat A = a->A,B = a->B;
1625 PetscErrorCode ierr;
1626 PetscReal isend[5],irecv[5];
1627
1628 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1628; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1629 info->block_size = (PetscReal)matin->rmap->bs;
1630
1631 ierr = MatGetInfo(A,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1632
1633 isend[0] = info->nz_used; isend[1] = info->nz_allocated; isend[2] = info->nz_unneeded;
1634 isend[3] = info->memory; isend[4] = info->mallocs;
1635
1636 ierr = MatGetInfo(B,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1636,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1637
1638 isend[0] += info->nz_used; isend[1] += info->nz_allocated; isend[2] += info->nz_unneeded;
1639 isend[3] += info->memory; isend[4] += info->mallocs;
1640 if (flag == MAT_LOCAL) {
1641 info->nz_used = isend[0];
1642 info->nz_allocated = isend[1];
1643 info->nz_unneeded = isend[2];
1644 info->memory = isend[3];
1645 info->mallocs = isend[4];
1646 } else if (flag == MAT_GLOBAL_MAX) {
1647 ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin
),5,1647,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)matin))),0) || MPI_Allreduce((isend),(irecv),(5
),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000001)),(PetscObjectComm
((PetscObject)matin)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1647,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1648
1649 info->nz_used = irecv[0];
1650 info->nz_allocated = irecv[1];
1651 info->nz_unneeded = irecv[2];
1652 info->memory = irecv[3];
1653 info->mallocs = irecv[4];
1654 } else if (flag == MAT_GLOBAL_SUM) {
1655 ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin
),5,1655,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)matin))),0) || MPI_Allreduce((isend),(irecv),(5
),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003)),(PetscObjectComm
((PetscObject)matin)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1655,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1656
1657 info->nz_used = irecv[0];
1658 info->nz_allocated = irecv[1];
1659 info->nz_unneeded = irecv[2];
1660 info->memory = irecv[3];
1661 info->mallocs = irecv[4];
1662 } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown MatInfoType argument %d",(int)flag)return PetscError(((MPI_Comm)0x44000001),1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Unknown MatInfoType argument %d",(int
)flag)
;
1663 info->fill_ratio_given = 0; /* no parallel LU/ILU/Cholesky */
1664 info->fill_ratio_needed = 0;
1665 info->factor_mallocs = 0;
1666 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1667}
1668
1669PetscErrorCode MatSetOption_MPISBAIJ(Mat A,MatOption op,PetscBool flg)
1670{
1671 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1672 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1673 PetscErrorCode ierr;
1674
1675 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1675; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1676 switch (op) {
1677 case MAT_NEW_NONZERO_LOCATIONS:
1678 case MAT_NEW_NONZERO_ALLOCATION_ERR:
1679 case MAT_UNUSED_NONZERO_LOCATION_ERR:
1680 case MAT_KEEP_NONZERO_PATTERN:
1681 case MAT_SUBMAT_SINGLEIS:
1682 case MAT_NEW_NONZERO_LOCATION_ERR:
1683 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1683,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1684 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1684,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1685 ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1685,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1686 break;
1687 case MAT_ROW_ORIENTED:
1688 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1689 a->roworiented = flg;
1690
1691 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1691,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1692 ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1693 break;
1694 case MAT_NEW_DIAGONALS:
1695 case MAT_SORTED_FULL:
1696 ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions
[op])
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1696,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1697 break;
1698 case MAT_IGNORE_OFF_PROC_ENTRIES:
1699 a->donotstash = flg;
1700 break;
1701 case MAT_USE_HASH_TABLE:
1702 a->ht_flag = flg;
1703 break;
1704 case MAT_HERMITIAN:
1705 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1705,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1706 if (!A->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must call MatAssemblyEnd() first")return PetscError(((MPI_Comm)0x44000001),1706,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatAssemblyEnd() first")
;
1707 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1707,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1708#if defined(PETSC_USE_COMPLEX)
1709 A->ops->mult = MatMult_MPISBAIJ_Hermitian;
1710#endif
1711 break;
1712 case MAT_SPD:
1713 A->spd_set = PETSC_TRUE;
1714 A->spd = flg;
1715 if (flg) {
1716 A->symmetric = PETSC_TRUE;
1717 A->structurally_symmetric = PETSC_TRUE;
1718 A->symmetric_set = PETSC_TRUE;
1719 A->structurally_symmetric_set = PETSC_TRUE;
1720 }
1721 break;
1722 case MAT_SYMMETRIC:
1723 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1723,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1724 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1724,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1725 break;
1726 case MAT_STRUCTURALLY_SYMMETRIC:
1727 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1727,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1728 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1728,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1729 break;
1730 case MAT_SYMMETRY_ETERNAL:
1731 if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Matrix must be symmetric")return PetscError(((MPI_Comm)0x44000001),1731,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Matrix must be symmetric")
;
1732 ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions
[op])
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1732,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1733 break;
1734 case MAT_IGNORE_LOWER_TRIANGULAR:
1735 aA->ignore_ltriangular = flg;
1736 break;
1737 case MAT_ERROR_LOWER_TRIANGULAR:
1738 aA->ignore_ltriangular = flg;
1739 break;
1740 case MAT_GETROW_UPPERTRIANGULAR:
1741 aA->getrow_utriangular = flg;
1742 break;
1743 default:
1744 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1744,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"unknown option %d",op)
;
1745 }
1746 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1747}
1748
1749PetscErrorCode MatTranspose_MPISBAIJ(Mat A,MatReuse reuse,Mat *B)
1750{
1751 PetscErrorCode ierr;
1752
1753 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1753; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1754 if (reuse == MAT_INITIAL_MATRIX) {
1755 ierr = MatDuplicate(A,MAT_COPY_VALUES,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1756 } else if (reuse == MAT_REUSE_MATRIX) {
1757 ierr = MatCopy(A,*B,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1757,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1758 }
1759 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1760}
1761
1762PetscErrorCode MatDiagonalScale_MPISBAIJ(Mat mat,Vec ll,Vec rr)
1763{
1764 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1765 Mat a = baij->A, b=baij->B;
1766 PetscErrorCode ierr;
1767 PetscInt nv,m,n;
1768 PetscBool flg;
1769
1770 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1770; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1771 if (ll != rr) {
1772 ierr = VecEqual(ll,rr,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1772,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1773 if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"For symmetric format, left and right scaling vectors must be same\n")return PetscError(((MPI_Comm)0x44000001),1773,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"For symmetric format, left and right scaling vectors must be same\n"
)
;
1774 }
1775 if (!ll) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1776
1777 ierr = MatGetLocalSize(mat,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1777,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1778 if (m != n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"For symmetric format, local size %d %d must be same",m,n)return PetscError(((MPI_Comm)0x44000001),1778,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"For symmetric format, local size %d %d must be same"
,m,n)
;
1779
1780 ierr = VecGetLocalSize(rr,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1780,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1781 if (nv!=n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left and right vector non-conforming local size")return PetscError(((MPI_Comm)0x44000001),1781,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Left and right vector non-conforming local size"
)
;
1782
1783 ierr = VecScatterBegin(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1783,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1784
1785 /* left diagonalscale the off-diagonal part */
1786 ierr = (*b->ops->diagonalscale)(b,ll,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1786,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1787
1788 /* scale the diagonal part */
1789 ierr = (*a->ops->diagonalscale)(a,ll,rr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1789,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1790
1791 /* right diagonalscale the off-diagonal part */
1792 ierr = VecScatterEnd(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1793 ierr = (*b->ops->diagonalscale)(b,NULL((void*)0),baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1793,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1794 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1795}
1796
1797PetscErrorCode MatSetUnfactored_MPISBAIJ(Mat A)
1798{
1799 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1800 PetscErrorCode ierr;
1801
1802 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1802; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1803 ierr = MatSetUnfactored(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1804 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1805}
1806
1807static PetscErrorCode MatDuplicate_MPISBAIJ(Mat,MatDuplicateOption,Mat*);
1808
1809PetscErrorCode MatEqual_MPISBAIJ(Mat A,Mat B,PetscBool *flag)
1810{
1811 Mat_MPISBAIJ *matB = (Mat_MPISBAIJ*)B->data,*matA = (Mat_MPISBAIJ*)A->data;
1812 Mat a,b,c,d;
1813 PetscBool flg;
1814 PetscErrorCode ierr;
1815
1816 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1816; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1817 a = matA->A; b = matA->B;
1818 c = matB->A; d = matB->B;
1819
1820 ierr = MatEqual(a,c,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1820,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1821 if (flg) {
1822 ierr = MatEqual(b,d,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1822,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1823 }
1824 ierr = MPIU_Allreduce(&flg,flag,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)A))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)A),1
,1824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)A))),0) || MPI_Allreduce((&flg),(flag),(1),
(MPIU_BOOL),((MPI_Op)(0x58000005)),(PetscObjectComm((PetscObject
)A)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1825 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1826}
1827
1828PetscErrorCode MatCopy_MPISBAIJ(Mat A,Mat B,MatStructure str)
1829{
1830 PetscErrorCode ierr;
1831 PetscBool isbaij;
1832
1833 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1833; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1834 ierr = PetscObjectTypeCompareAny((PetscObject)B,&isbaij,MATSEQSBAIJ"seqsbaij",MATMPISBAIJ"mpisbaij","");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1835 if (!isbaij) SETERRQ1(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"Not for matrix type %s",((PetscObject)B)->type_name)return PetscError(PetscObjectComm((PetscObject)B),1835,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Not for matrix type %s",((PetscObject
)B)->type_name)
;
1836 /* If the two matrices don't have the same copy implementation, they aren't compatible for fast copy. */
1837 if ((str != SAME_NONZERO_PATTERN) || (A->ops->copy != B->ops->copy)) {
1838 ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1839 ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1840 ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1840,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1841 } else {
1842 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1843 Mat_MPISBAIJ *b = (Mat_MPISBAIJ*)B->data;
1844
1845 ierr = MatCopy(a->A,b->A,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1845,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1846 ierr = MatCopy(a->B,b->B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1846,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1847 }
1848 ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1848,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1849 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1850}
1851
1852PetscErrorCode MatSetUp_MPISBAIJ(Mat A)
1853{
1854 PetscErrorCode ierr;
1855
1856 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1856; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1857 ierr = MatMPISBAIJSetPreallocation(A,A->rmap->bs,PETSC_DEFAULT-2,0,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1857,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1858 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1859}
1860
1861PetscErrorCode MatAXPY_MPISBAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str)
1862{
1863 PetscErrorCode ierr;
1864 Mat_MPISBAIJ *xx=(Mat_MPISBAIJ*)X->data,*yy=(Mat_MPISBAIJ*)Y->data;
1865 PetscBLASInt bnz,one=1;
1866 Mat_SeqSBAIJ *xa,*ya;
1867 Mat_SeqBAIJ *xb,*yb;
1868
1869 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1869; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1870 if (str == SAME_NONZERO_PATTERN) {
1871 PetscScalar alpha = a;
1872 xa = (Mat_SeqSBAIJ*)xx->A->data;
1873 ya = (Mat_SeqSBAIJ*)yy->A->data;
1874 ierr = PetscBLASIntCast(xa->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1874,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1875 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,xa->a,&one,ya->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/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1875; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
daxpy_(&bnz,&alpha,xa->a,&one,ya->a,&one
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(1875
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1875,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do {
; if (petscstack && petscstack->currentsize > 0
) { petscstack->currentsize--; petscstack->function[petscstack
->currentsize] = 0; petscstack->file[petscstack->currentsize
] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; }
if (petscstack) { petscstack->hotdepth = (((petscstack->
hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ;
} while (0); } while (0); } while(0)
;
1876 xb = (Mat_SeqBAIJ*)xx->B->data;
1877 yb = (Mat_SeqBAIJ*)yy->B->data;
1878 ierr = PetscBLASIntCast(xb->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1878,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1879 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,xb->a,&one,yb->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/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1879; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
daxpy_(&bnz,&alpha,xb->a,&one,yb->a,&one
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(1879
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1879,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do {
; if (petscstack && petscstack->currentsize > 0
) { petscstack->currentsize--; petscstack->function[petscstack
->currentsize] = 0; petscstack->file[petscstack->currentsize
] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; }
if (petscstack) { petscstack->hotdepth = (((petscstack->
hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ;
} while (0); } while (0); } while(0)
;
1880 ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1880,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1881 } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */
1882 ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1882,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1883 ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1883,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1884 ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1884,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1885 } else {
1886 Mat B;
1887 PetscInt *nnz_d,*nnz_o,bs=Y->rmap->bs;
1888 if (bs != X->rmap->bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Matrices must have same block size")return PetscError(((MPI_Comm)0x44000001),1888,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Matrices must have same block size")
;
1889 ierr = MatGetRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1889,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1890 ierr = MatGetRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1890,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1891 ierr = PetscMalloc1(yy->A->rmap->N,&nnz_d)PetscMallocA(1,PETSC_FALSE,1891,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(yy->A->rmap->N)*sizeof(**(&nnz_d)),(&
nnz_d))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1891,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1892 ierr = PetscMalloc1(yy->B->rmap->N,&nnz_o)PetscMallocA(1,PETSC_FALSE,1892,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(yy->B->rmap->N)*sizeof(**(&nnz_o)),(&
nnz_o))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1892,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1893 ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1893,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1894 ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1894,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1895 ierr = MatSetSizes(B,Y->rmap->n,Y->cmap->n,Y->rmap->N,Y->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1895,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1896 ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1896,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1897 ierr = MatSetType(B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1897,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1898 ierr = MatAXPYGetPreallocation_SeqSBAIJ(yy->A,xx->A,nnz_d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1898,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1899 ierr = MatAXPYGetPreallocation_MPIBAIJ(yy->B,yy->garray,xx->B,xx->garray,nnz_o);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1899,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1900 ierr = MatMPISBAIJSetPreallocation(B,bs,0,nnz_d,0,nnz_o);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1900,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1901 ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1901,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1902 ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1902,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1903 ierr = PetscFree(nnz_d)((*PetscTrFree)((void*)(nnz_d),1903,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((nnz_d) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1903,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1904 ierr = PetscFree(nnz_o)((*PetscTrFree)((void*)(nnz_o),1904,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((nnz_o) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1904,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1905 ierr = MatRestoreRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1906 ierr = MatRestoreRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1907 }
1908 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1909}
1910
1911PetscErrorCode MatCreateSubMatrices_MPISBAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[])
1912{
1913 PetscErrorCode ierr;
1914 PetscInt i;
1915 PetscBool flg;
1916
1917 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1917; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1918 ierr = MatCreateSubMatrices_MPIBAIJ(A,n,irow,icol,scall,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1918,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* B[] are sbaij matrices */
1919 for (i=0; i<n; i++) {
1920 ierr = ISEqual(irow[i],icol[i],&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1920,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1921 if (!flg) {
1922 ierr = MatSeqSBAIJZeroOps_Private(*B[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1922,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1923 }
1924 }
1925 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1926}
1927
1928PetscErrorCode MatShift_MPISBAIJ(Mat Y,PetscScalar a)
1929{
1930 PetscErrorCode ierr;
1931 Mat_MPISBAIJ *maij = (Mat_MPISBAIJ*)Y->data;
1932 Mat_SeqSBAIJ *aij = (Mat_SeqSBAIJ*)maij->A->data;
1933
1934 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1934; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1935 if (!Y->preallocated) {
1936 ierr = MatMPISBAIJSetPreallocation(Y,Y->rmap->bs,1,NULL((void*)0),0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1936,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1937 } else if (!aij->nz) {
1938 PetscInt nonew = aij->nonew;
1939 ierr = MatSeqSBAIJSetPreallocation(maij->A,Y->rmap->bs,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1939,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1940 aij->nonew = nonew;
1941 }
1942 ierr = MatShift_Basic(Y,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1942,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1943 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1944}
1945
1946PetscErrorCode MatMissingDiagonal_MPISBAIJ(Mat A,PetscBool *missing,PetscInt *d)
1947{
1948 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1949 PetscErrorCode ierr;
1950
1951 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1951; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1952 if (A->rmap->n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only works for square matrices")return PetscError(((MPI_Comm)0x44000001),1952,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only works for square matrices")
;
1953 ierr = MatMissingDiagonal(a->A,missing,d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1954 if (d) {
1955 PetscInt rstart;
1956 ierr = MatGetOwnershipRange(A,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1957 *d += rstart/A->rmap->bs;
1958
1959 }
1960 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1961}
1962
1963PetscErrorCode MatGetDiagonalBlock_MPISBAIJ(Mat A,Mat *a)
1964{
1965 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1965; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1966 *a = ((Mat_MPISBAIJ*)A->data)->A;
1967 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1968}
1969
1970/* -------------------------------------------------------------------*/
1971static struct _MatOps MatOps_Values = {MatSetValues_MPISBAIJ,
1972 MatGetRow_MPISBAIJ,
1973 MatRestoreRow_MPISBAIJ,
1974 MatMult_MPISBAIJ,
1975 /* 4*/ MatMultAdd_MPISBAIJ,
1976 MatMult_MPISBAIJ, /* transpose versions are same as non-transpose */
1977 MatMultAdd_MPISBAIJ,
1978 0,
1979 0,
1980 0,
1981 /* 10*/ 0,
1982 0,
1983 0,
1984 MatSOR_MPISBAIJ,
1985 MatTranspose_MPISBAIJ,
1986 /* 15*/ MatGetInfo_MPISBAIJ,
1987 MatEqual_MPISBAIJ,
1988 MatGetDiagonal_MPISBAIJ,
1989 MatDiagonalScale_MPISBAIJ,
1990 MatNorm_MPISBAIJ,
1991 /* 20*/ MatAssemblyBegin_MPISBAIJ,
1992 MatAssemblyEnd_MPISBAIJ,
1993 MatSetOption_MPISBAIJ,
1994 MatZeroEntries_MPISBAIJ,
1995 /* 24*/ 0,
1996 0,
1997 0,
1998 0,
1999 0,
2000 /* 29*/ MatSetUp_MPISBAIJ,
2001 0,
2002 0,
2003 MatGetDiagonalBlock_MPISBAIJ,
2004 0,
2005 /* 34*/ MatDuplicate_MPISBAIJ,
2006 0,
2007 0,
2008 0,
2009 0,
2010 /* 39*/ MatAXPY_MPISBAIJ,
2011 MatCreateSubMatrices_MPISBAIJ,
2012 MatIncreaseOverlap_MPISBAIJ,
2013 MatGetValues_MPISBAIJ,
2014 MatCopy_MPISBAIJ,
2015 /* 44*/ 0,
2016 MatScale_MPISBAIJ,
2017 MatShift_MPISBAIJ,
2018 0,
2019 0,
2020 /* 49*/ 0,
2021 0,
2022 0,
2023 0,
2024 0,
2025 /* 54*/ 0,
2026 0,
2027 MatSetUnfactored_MPISBAIJ,
2028 0,
2029 MatSetValuesBlocked_MPISBAIJ,
2030 /* 59*/ MatCreateSubMatrix_MPISBAIJ,
2031 0,
2032 0,
2033 0,
2034 0,
2035 /* 64*/ 0,
2036 0,
2037 0,
2038 0,
2039 0,
2040 /* 69*/ MatGetRowMaxAbs_MPISBAIJ,
2041 0,
2042 0,
2043 0,
2044 0,
2045 /* 74*/ 0,
2046 0,
2047 0,
2048 0,
2049 0,
2050 /* 79*/ 0,
2051 0,
2052 0,
2053 0,
2054 MatLoad_MPISBAIJ,
2055 /* 84*/ 0,
2056 0,
2057 0,
2058 0,
2059 0,
2060 /* 89*/ 0,
2061 0,
2062 0,
2063 0,
2064 0,
2065 /* 94*/ 0,
2066 0,
2067 0,
2068 0,
2069 0,
2070 /* 99*/ 0,
2071 0,
2072 0,
2073 0,
2074 0,
2075 /*104*/ 0,
2076 MatRealPart_MPISBAIJ,
2077 MatImaginaryPart_MPISBAIJ,
2078 MatGetRowUpperTriangular_MPISBAIJ,
2079 MatRestoreRowUpperTriangular_MPISBAIJ,
2080 /*109*/ 0,
2081 0,
2082 0,
2083 0,
2084 MatMissingDiagonal_MPISBAIJ,
2085 /*114*/ 0,
2086 0,
2087 0,
2088 0,
2089 0,
2090 /*119*/ 0,
2091 0,
2092 0,
2093 0,
2094 0,
2095 /*124*/ 0,
2096 0,
2097 0,
2098 0,
2099 0,
2100 /*129*/ 0,
2101 0,
2102 0,
2103 0,
2104 0,
2105 /*134*/ 0,
2106 0,
2107 0,
2108 0,
2109 0,
2110 /*139*/ MatSetBlockSizes_Default,
2111 0,
2112 0,
2113 0,
2114 0,
2115 /*144*/MatCreateMPIMatConcatenateSeqMat_MPISBAIJ
2116};
2117
2118PetscErrorCode MatMPISBAIJSetPreallocation_MPISBAIJ(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt *d_nnz,PetscInt o_nz,const PetscInt *o_nnz)
2119{
2120 Mat_MPISBAIJ *b;
2121 PetscErrorCode ierr;
2122 PetscInt i,mbs,Mbs;
2123 PetscMPIInt size;
2124
2125 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2125; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2126 ierr = MatSetBlockSize(B,PetscAbs(bs)(((bs) >= 0) ? (bs) : (-(bs))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2127 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2128 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2129 ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2129,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2130
2131 b = (Mat_MPISBAIJ*)B->data;
2132 mbs = B->rmap->n/bs;
2133 Mbs = B->rmap->N/bs;
2134 if (mbs*bs != B->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"No of local rows %D must be divisible by blocksize %D",B->rmap->N,bs)return PetscError(((MPI_Comm)0x44000001),2134,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"No of local rows %D must be divisible by blocksize %D"
,B->rmap->N,bs)
;
2135
2136 B->rmap->bs = bs;
2137 b->bs2 = bs*bs;
2138 b->mbs = mbs;
2139 b->Mbs = Mbs;
2140 b->nbs = B->cmap->n/bs;
2141 b->Nbs = B->cmap->N/bs;
2142
2143 for (i=0; i<=b->size; i++) {
2144 b->rangebs[i] = B->rmap->range[i]/bs;
2145 }
2146 b->rstartbs = B->rmap->rstart/bs;
2147 b->rendbs = B->rmap->rend/bs;
2148
2149 b->cstartbs = B->cmap->rstart/bs;
2150 b->cendbs = B->cmap->rend/bs;
2151
2152#if defined(PETSC_USE_CTABLE1)
2153 ierr = PetscTableDestroy(&b->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2154#else
2155 ierr = PetscFree(b->colmap)((*PetscTrFree)((void*)(b->colmap),2155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((b->colmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2155,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2156#endif
2157 ierr = PetscFree(b->garray)((*PetscTrFree)((void*)(b->garray),2157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((b->garray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2158 ierr = VecDestroy(&b->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2158,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2159 ierr = VecScatterDestroy(&b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2160 ierr = VecDestroy(&b->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2161 ierr = VecDestroy(&b->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2162 ierr = VecDestroy(&b->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2162,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2163 ierr = VecDestroy(&b->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2164 ierr = VecDestroy(&b->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2165 ierr = VecScatterDestroy(&b->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2166
2167 /* Because the B will have been resized we simply destroy it and create a new one each time */
2168 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2169 ierr = MatDestroy(&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2170 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2170,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2171 ierr = MatSetSizes(b->B,B->rmap->n,size > 1 ? B->cmap->N : 0,B->rmap->n,size > 1 ? B->cmap->N : 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2172 ierr = MatSetType(b->B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2172,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2173 ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2173,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2174
2175 if (!B->preallocated) {
2176 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2177 ierr = MatSetSizes(b->A,B->rmap->n,B->cmap->n,B->rmap->n,B->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2177,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2178 ierr = MatSetType(b->A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2179 ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2180 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),bs,&B->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2181 }
2182
2183 ierr = MatSeqSBAIJSetPreallocation(b->A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2184 ierr = MatSeqBAIJSetPreallocation(b->B,bs,o_nz,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2184,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2185
2186 B->preallocated = PETSC_TRUE;
2187 B->was_assembled = PETSC_FALSE;
2188 B->assembled = PETSC_FALSE;
2189 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2190}
2191
2192PetscErrorCode MatMPISBAIJSetPreallocationCSR_MPISBAIJ(Mat B,PetscInt bs,const PetscInt ii[],const PetscInt jj[],const PetscScalar V[])
2193{
2194 PetscInt m,rstart,cstart,cend;
2195 PetscInt i,j,d,nz,nz_max=0,*d_nnz=0,*o_nnz=0;
2196 const PetscInt *JJ =0;
2197 PetscScalar *values=0;
2198 PetscErrorCode ierr;
2199
2200 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2200; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2201 if (bs < 1) SETERRQ1(PetscObjectComm((PetscObject)B),PETSC_ERR_ARG_OUTOFRANGE,"Invalid block size specified, must be positive but it is %D",bs)return PetscError(PetscObjectComm((PetscObject)B),2201,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Invalid block size specified, must be positive but it is %D"
,bs)
;
2202 ierr = PetscLayoutSetBlockSize(B->rmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2203 ierr = PetscLayoutSetBlockSize(B->cmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2204 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2205 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2206 ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2207 m = B->rmap->n/bs;
2208 rstart = B->rmap->rstart/bs;
2209 cstart = B->cmap->rstart/bs;
2210 cend = B->cmap->rend/bs;
2211
2212 if (ii[0]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"ii[0] must be 0 but it is %D",ii[0])return PetscError(((MPI_Comm)0x44000001),2212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"ii[0] must be 0 but it is %D",ii[0])
;
2213 ierr = PetscMalloc2(m,&d_nnz,m,&o_nnz)PetscMallocA(2,PETSC_FALSE,2213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(m)*sizeof(**(&d_nnz)),(&d_nnz),(size_t)(m)*
sizeof(**(&o_nnz)),(&o_nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2214 for (i=0; i<m; i++) {
2215 nz = ii[i+1] - ii[i];
2216 if (nz < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Local row %D has a negative number of columns %D",i,nz)return PetscError(((MPI_Comm)0x44000001),2216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Local row %D has a negative number of columns %D"
,i,nz)
;
2217 nz_max = PetscMax(nz_max,nz)(((nz_max)<(nz)) ? (nz) : (nz_max));
2218 JJ = jj + ii[i];
2219 for (j=0; j<nz; j++) {
2220 if (*JJ >= cstart) break;
2221 JJ++;
2222 }
2223 d = 0;
2224 for (; j<nz; j++) {
2225 if (*JJ++ >= cend) break;
2226 d++;
2227 }
2228 d_nnz[i] = d;
2229 o_nnz[i] = nz - d;
2230 }
2231 ierr = MatMPISBAIJSetPreallocation(B,bs,0,d_nnz,0,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2232 ierr = PetscFree2(d_nnz,o_nnz)PetscFreeA(2,2232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(d_nnz),&(o_nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2233
2234 values = (PetscScalar*)V;
2235 if (!values) {
2236 ierr = PetscCalloc1(bs*bs*nz_max,&values)PetscMallocA(1,PETSC_TRUE,2236,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs*bs*nz_max)*sizeof(**(&values)),(&values)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2236,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2237 }
2238 for (i=0; i<m; i++) {
2239 PetscInt row = i + rstart;
2240 PetscInt ncols = ii[i+1] - ii[i];
2241 const PetscInt *icols = jj + ii[i];
2242 const PetscScalar *svals = values + (V ? (bs*bs*ii[i]) : 0);
2243 ierr = MatSetValuesBlocked_MPISBAIJ(B,1,&row,ncols,icols,svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2244 }
2245
2246 if (!V) { ierr = PetscFree(values)((*PetscTrFree)((void*)(values),2246,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2246,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
2247 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2248 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2248,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2249 ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2249,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2250 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2251}
2252
2253/*MC
2254 MATMPISBAIJ - MATMPISBAIJ = "mpisbaij" - A matrix type to be used for distributed symmetric sparse block matrices,
2255 based on block compressed sparse row format. Only the upper triangular portion of the "diagonal" portion of
2256 the matrix is stored.
2257
2258 For complex numbers by default this matrix is symmetric, NOT Hermitian symmetric. To make it Hermitian symmetric you
2259 can call MatSetOption(Mat, MAT_HERMITIAN);
2260
2261 Options Database Keys:
2262. -mat_type mpisbaij - sets the matrix type to "mpisbaij" during a call to MatSetFromOptions()
2263
2264 Level: beginner
2265
2266.seealso: MatCreateMPISBAIJ
2267M*/
2268
2269PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_MPISBAIJ(Mat B)
2270{
2271 Mat_MPISBAIJ *b;
2272 PetscErrorCode ierr;
2273 PetscBool flg = PETSC_FALSE;
2274
2275 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2275; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2276 ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,2276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(1)*sizeof(**(((&b)))),(((&b)))) || PetscLogObjectMemory
((PetscObject)B,sizeof(**(&b))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2277 B->data = (void*)b;
2278 ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2278,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2279
2280 B->ops->destroy = MatDestroy_MPISBAIJ;
2281 B->ops->view = MatView_MPISBAIJ;
2282 B->assembled = PETSC_FALSE;
2283 B->insertmode = NOT_SET_VALUES;
2284
2285 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)B),&b->rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2285,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2286 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&b->size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2287
2288 /* build local table of row and column ownerships */
2289 ierr = PetscMalloc1(b->size+2,&b->rangebs)PetscMallocA(1,PETSC_FALSE,2289,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(b->size+2)*sizeof(**(&b->rangebs)),(&
b->rangebs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2289,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2290
2291 /* build cache for off array entries formed */
2292 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),1,&B->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2292,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2293
2294 b->donotstash = PETSC_FALSE;
2295 b->colmap = NULL((void*)0);
2296 b->garray = NULL((void*)0);
2297 b->roworiented = PETSC_TRUE;
2298
2299 /* stuff used in block assembly */
2300 b->barray = 0;
2301
2302 /* stuff used for matrix vector multiply */
2303 b->lvec = 0;
2304 b->Mvctx = 0;
2305 b->slvec0 = 0;
2306 b->slvec0b = 0;
2307 b->slvec1 = 0;
2308 b->slvec1a = 0;
2309 b->slvec1b = 0;
2310 b->sMvctx = 0;
2311
2312 /* stuff for MatGetRow() */
2313 b->rowindices = 0;
2314 b->rowvalues = 0;
2315 b->getrowactive = PETSC_FALSE;
2316
2317 /* hash table stuff */
2318 b->ht = 0;
2319 b->hd = 0;
2320 b->ht_size = 0;
2321 b->ht_flag = PETSC_FALSE;
2322 b->ht_fact = 0;
2323 b->ht_total_ct = 0;
2324 b->ht_insert_ct = 0;
2325
2326 /* stuff for MatCreateSubMatrices_MPIBAIJ_local() */
2327 b->ijonly = PETSC_FALSE;
2328
2329 b->in_loc = 0;
2330 b->v_loc = 0;
2331 b->n_loc = 0;
2332
2333 ierr = PetscObjectComposeFunction((PetscObject)B,"MatStoreValues_C",MatStoreValues_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatStoreValues_C"
,(PetscVoidFunction)(MatStoreValues_MPISBAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2333,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2334 ierr = PetscObjectComposeFunction((PetscObject)B,"MatRetrieveValues_C",MatRetrieveValues_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatRetrieveValues_C"
,(PetscVoidFunction)(MatRetrieveValues_MPISBAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2334,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2335 ierr = PetscObjectComposeFunction((PetscObject)B,"MatMPISBAIJSetPreallocation_C",MatMPISBAIJSetPreallocation_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMPISBAIJSetPreallocation_C"
,(PetscVoidFunction)(MatMPISBAIJSetPreallocation_MPISBAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2335,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2336 ierr = PetscObjectComposeFunction((PetscObject)B,"MatMPISBAIJSetPreallocationCSR_C",MatMPISBAIJSetPreallocationCSR_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMPISBAIJSetPreallocationCSR_C"
,(PetscVoidFunction)(MatMPISBAIJSetPreallocationCSR_MPISBAIJ)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2337#if defined(PETSC_HAVE_ELEMENTAL)
2338 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_mpisbaij_elemental_C",MatConvert_MPISBAIJ_Elemental)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_mpisbaij_elemental_C"
,(PetscVoidFunction)(MatConvert_MPISBAIJ_Elemental))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2338,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2339#endif
2340 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_mpisbaij_mpiaij_C",MatConvert_MPISBAIJ_XAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_mpisbaij_mpiaij_C"
,(PetscVoidFunction)(MatConvert_MPISBAIJ_XAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2341 ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_mpisbaij_mpibaij_C",MatConvert_MPISBAIJ_XAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_mpisbaij_mpibaij_C"
,(PetscVoidFunction)(MatConvert_MPISBAIJ_XAIJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2341,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2342
2343 B->symmetric = PETSC_TRUE;
2344 B->structurally_symmetric = PETSC_TRUE;
2345 B->symmetric_set = PETSC_TRUE;
2346 B->structurally_symmetric_set = PETSC_TRUE;
2347 B->symmetric_eternal = PETSC_TRUE;
2348
2349 B->hermitian = PETSC_FALSE;
2350 B->hermitian_set = PETSC_FALSE;
2351
2352 ierr = PetscObjectChangeTypeName((PetscObject)B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2353 ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)B),NULL,"Options for loading MPISBAIJ matrix 1","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems
*PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero
(PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject
->count=(PetscOptionsPublish?-1:1); PetscOptionsObject->
count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr
= PetscOptionsBegin_Private(PetscOptionsObject,PetscObjectComm
((PetscObject)B),((void*)0),"Options for loading MPISBAIJ matrix 1"
,"Mat");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),2353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2354 ierr = PetscOptionsBool("-mat_use_hash_table","Use hash table to save memory in constructing matrix","MatSetOption",flg,&flg,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-mat_use_hash_table"
,"Use hash table to save memory in constructing matrix","MatSetOption"
,flg,&flg,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2354,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2355 if (flg) {
2356 PetscReal fact = 1.39;
2357 ierr = MatSetOption(B,MAT_USE_HASH_TABLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2357,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2358 ierr = PetscOptionsReal("-mat_use_hash_table","Use hash table factor","MatMPIBAIJSetHashTableFactor",fact,&fact,NULL)PetscOptionsReal_Private(PetscOptionsObject,"-mat_use_hash_table"
,"Use hash table factor","MatMPIBAIJSetHashTableFactor",fact,
&fact,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2359 if (fact <= 1.0) fact = 1.39;
2360 ierr = MatMPIBAIJSetHashTableFactor(B,fact);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2361 ierr = PetscInfo1(B,"Hash table Factor used %5.2f\n",fact)PetscInfo_Private(__func__,B,"Hash table Factor used %5.2f\n"
,fact)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2362 }
2363 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2364 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2365}
2366
2367/*MC
2368 MATSBAIJ - MATSBAIJ = "sbaij" - A matrix type to be used for symmetric block sparse matrices.
2369
2370 This matrix type is identical to MATSEQSBAIJ when constructed with a single process communicator,
2371 and MATMPISBAIJ otherwise.
2372
2373 Options Database Keys:
2374. -mat_type sbaij - sets the matrix type to "sbaij" during a call to MatSetFromOptions()
2375
2376 Level: beginner
2377
2378.seealso: MatCreateMPISBAIJ,MATSEQSBAIJ,MATMPISBAIJ
2379M*/
2380
2381/*@C
2382 MatMPISBAIJSetPreallocation - For good matrix assembly performance
2383 the user should preallocate the matrix storage by setting the parameters
2384 d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately,
2385 performance can be increased by more than a factor of 50.
2386
2387 Collective on Mat
2388
2389 Input Parameters:
2390+ B - the matrix
2391. bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row
2392 blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()
2393. d_nz - number of block nonzeros per block row in diagonal portion of local
2394 submatrix (same for all local rows)
2395. d_nnz - array containing the number of block nonzeros in the various block rows
2396 in the upper triangular and diagonal part of the in diagonal portion of the local
2397 (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room
2398 for the diagonal entry and set a value even if it is zero.
2399. o_nz - number of block nonzeros per block row in the off-diagonal portion of local
2400 submatrix (same for all local rows).
2401- o_nnz - array containing the number of nonzeros in the various block rows of the
2402 off-diagonal portion of the local submatrix that is right of the diagonal
2403 (possibly different for each block row) or NULL.
2404
2405
2406 Options Database Keys:
2407. -mat_no_unroll - uses code that does not unroll the loops in the
2408 block calculations (much slower)
2409. -mat_block_size - size of the blocks to use
2410
2411 Notes:
2412
2413 If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor
2414 than it must be used on all processors that share the object for that argument.
2415
2416 If the *_nnz parameter is given then the *_nz parameter is ignored
2417
2418 Storage Information:
2419 For a square global matrix we define each processor's diagonal portion
2420 to be its local rows and the corresponding columns (a square submatrix);
2421 each processor's off-diagonal portion encompasses the remainder of the
2422 local matrix (a rectangular submatrix).
2423
2424 The user can specify preallocated storage for the diagonal part of
2425 the local submatrix with either d_nz or d_nnz (not both). Set
2426 d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic
2427 memory allocation. Likewise, specify preallocated storage for the
2428 off-diagonal part of the local submatrix with o_nz or o_nnz (not both).
2429
2430 You can call MatGetInfo() to get information on how effective the preallocation was;
2431 for example the fields mallocs,nz_allocated,nz_used,nz_unneeded;
2432 You can also run with the option -info and look for messages with the string
2433 malloc in them to see if additional memory allocation was needed.
2434
2435 Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In
2436 the figure below we depict these three local rows and all columns (0-11).
2437
2438.vb
2439 0 1 2 3 4 5 6 7 8 9 10 11
2440 --------------------------
2441 row 3 |. . . d d d o o o o o o
2442 row 4 |. . . d d d o o o o o o
2443 row 5 |. . . d d d o o o o o o
2444 --------------------------
2445.ve
2446
2447 Thus, any entries in the d locations are stored in the d (diagonal)
2448 submatrix, and any entries in the o locations are stored in the
2449 o (off-diagonal) submatrix. Note that the d matrix is stored in
2450 MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format.
2451
2452 Now d_nz should indicate the number of block nonzeros per row in the upper triangular
2453 plus the diagonal part of the d matrix,
2454 and o_nz should indicate the number of block nonzeros per row in the o matrix
2455
2456 In general, for PDE problems in which most nonzeros are near the diagonal,
2457 one expects d_nz >> o_nz. For large problems you MUST preallocate memory
2458 or you will get TERRIBLE performance; see the users' manual chapter on
2459 matrices.
2460
2461 Level: intermediate
2462
2463.seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), PetscSplitOwnership()
2464@*/
2465PetscErrorCode MatMPISBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[])
2466{
2467 PetscErrorCode ierr;
2468
2469 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2469; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2470 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),2470,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),2470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.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),2470,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2470,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
2471 PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) return PetscError((
(MPI_Comm)0x44000001),2471,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"%s object's type is not set: Argument # %d"
,((PetscObject)B)->class_name,1); } while (0)
;
2472 PetscValidLogicalCollectiveInt(B,bs,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -bs
; b1[1] = bs; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)B),2,2472,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),2472,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)B),2472,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
2473 ierr = PetscTryMethod(B,"MatMPISBAIJSetPreallocation_C",(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]),(B,bs,d_nz,d_nnz,o_nz,o_nnz))0; do { PetscErrorCode (*f)(Mat,PetscInt,PetscInt,const PetscInt
[],PetscInt,const PetscInt[]), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)B),("MatMPISBAIJSetPreallocation_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError
(((MPI_Comm)0x44000001),2473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(B,bs,d_nz,d_nnz,o_nz,o_nnz);do {if (__builtin_expect(!!
(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),2473,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2473,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2474 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2475}
2476
2477/*@C
2478 MatCreateSBAIJ - Creates a sparse parallel matrix in symmetric block AIJ format
2479 (block compressed row). For good matrix assembly performance
2480 the user should preallocate the matrix storage by setting the parameters
2481 d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately,
2482 performance can be increased by more than a factor of 50.
2483
2484 Collective
2485
2486 Input Parameters:
2487+ comm - MPI communicator
2488. bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row
2489 blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()
2490. m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
2491 This value should be the same as the local size used in creating the
2492 y vector for the matrix-vector product y = Ax.
2493. n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
2494 This value should be the same as the local size used in creating the
2495 x vector for the matrix-vector product y = Ax.
2496. M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
2497. N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
2498. d_nz - number of block nonzeros per block row in diagonal portion of local
2499 submatrix (same for all local rows)
2500. d_nnz - array containing the number of block nonzeros in the various block rows
2501 in the upper triangular portion of the in diagonal portion of the local
2502 (possibly different for each block block row) or NULL.
2503 If you plan to factor the matrix you must leave room for the diagonal entry and
2504 set its value even if it is zero.
2505. o_nz - number of block nonzeros per block row in the off-diagonal portion of local
2506 submatrix (same for all local rows).
2507- o_nnz - array containing the number of nonzeros in the various block rows of the
2508 off-diagonal portion of the local submatrix (possibly different for
2509 each block row) or NULL.
2510
2511 Output Parameter:
2512. A - the matrix
2513
2514 Options Database Keys:
2515. -mat_no_unroll - uses code that does not unroll the loops in the
2516 block calculations (much slower)
2517. -mat_block_size - size of the blocks to use
2518. -mat_mpi - use the parallel matrix data structures even on one processor
2519 (defaults to using SeqBAIJ format on one processor)
2520
2521 It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(),
2522 MatXXXXSetPreallocation() paradigm instead of this routine directly.
2523 [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation]
2524
2525 Notes:
2526 The number of rows and columns must be divisible by blocksize.
2527 This matrix type does not support complex Hermitian operation.
2528
2529 The user MUST specify either the local or global matrix dimensions
2530 (possibly both).
2531
2532 If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor
2533 than it must be used on all processors that share the object for that argument.
2534
2535 If the *_nnz parameter is given then the *_nz parameter is ignored
2536
2537 Storage Information:
2538 For a square global matrix we define each processor's diagonal portion
2539 to be its local rows and the corresponding columns (a square submatrix);
2540 each processor's off-diagonal portion encompasses the remainder of the
2541 local matrix (a rectangular submatrix).
2542
2543 The user can specify preallocated storage for the diagonal part of
2544 the local submatrix with either d_nz or d_nnz (not both). Set
2545 d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic
2546 memory allocation. Likewise, specify preallocated storage for the
2547 off-diagonal part of the local submatrix with o_nz or o_nnz (not both).
2548
2549 Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In
2550 the figure below we depict these three local rows and all columns (0-11).
2551
2552.vb
2553 0 1 2 3 4 5 6 7 8 9 10 11
2554 --------------------------
2555 row 3 |. . . d d d o o o o o o
2556 row 4 |. . . d d d o o o o o o
2557 row 5 |. . . d d d o o o o o o
2558 --------------------------
2559.ve
2560
2561 Thus, any entries in the d locations are stored in the d (diagonal)
2562 submatrix, and any entries in the o locations are stored in the
2563 o (off-diagonal) submatrix. Note that the d matrix is stored in
2564 MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format.
2565
2566 Now d_nz should indicate the number of block nonzeros per row in the upper triangular
2567 plus the diagonal part of the d matrix,
2568 and o_nz should indicate the number of block nonzeros per row in the o matrix.
2569 In general, for PDE problems in which most nonzeros are near the diagonal,
2570 one expects d_nz >> o_nz. For large problems you MUST preallocate memory
2571 or you will get TERRIBLE performance; see the users' manual chapter on
2572 matrices.
2573
2574 Level: intermediate
2575
2576.seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ()
2577@*/
2578
2579PetscErrorCode MatCreateSBAIJ(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt d_nz,const PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[],Mat *A)
2580{
2581 PetscErrorCode ierr;
2582 PetscMPIInt size;
2583
2584 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2584; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2585 ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2585,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2586 ierr = MatSetSizes(*A,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2586,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2587 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2588 if (size > 1) {
2589 ierr = MatSetType(*A,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2589,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2590 ierr = MatMPISBAIJSetPreallocation(*A,bs,d_nz,d_nnz,o_nz,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2590,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2591 } else {
2592 ierr = MatSetType(*A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2592,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2593 ierr = MatSeqSBAIJSetPreallocation(*A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2593,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2594 }
2595 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2596}
2597
2598
2599static PetscErrorCode MatDuplicate_MPISBAIJ(Mat matin,MatDuplicateOption cpvalues,Mat *newmat)
2600{
2601 Mat mat;
2602 Mat_MPISBAIJ *a,*oldmat = (Mat_MPISBAIJ*)matin->data;
2603 PetscErrorCode ierr;
2604 PetscInt len=0,nt,bs=matin->rmap->bs,mbs=oldmat->mbs;
2605 PetscScalar *array;
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/sbaij/mpi/mpisbaij.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 *newmat = 0;
2609
2610 ierr = MatCreate(PetscObjectComm((PetscObject)matin),&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2610,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2611 ierr = MatSetSizes(mat,matin->rmap->n,matin->cmap->n,matin->rmap->N,matin->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2611,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2612 ierr = MatSetType(mat,((PetscObject)matin)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2613 ierr = PetscLayoutReference(matin->rmap,&mat->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2614 ierr = PetscLayoutReference(matin->cmap,&mat->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2614,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2615
2616 mat->factortype = matin->factortype;
2617 mat->preallocated = PETSC_TRUE;
2618 mat->assembled = PETSC_TRUE;
2619 mat->insertmode = NOT_SET_VALUES;
2620
2621 a = (Mat_MPISBAIJ*)mat->data;
2622 a->bs2 = oldmat->bs2;
2623 a->mbs = oldmat->mbs;
2624 a->nbs = oldmat->nbs;
2625 a->Mbs = oldmat->Mbs;
2626 a->Nbs = oldmat->Nbs;
2627
2628 a->size = oldmat->size;
2629 a->rank = oldmat->rank;
2630 a->donotstash = oldmat->donotstash;
2631 a->roworiented = oldmat->roworiented;
2632 a->rowindices = 0;
2633 a->rowvalues = 0;
2634 a->getrowactive = PETSC_FALSE;
2635 a->barray = 0;
2636 a->rstartbs = oldmat->rstartbs;
2637 a->rendbs = oldmat->rendbs;
2638 a->cstartbs = oldmat->cstartbs;
2639 a->cendbs = oldmat->cendbs;
2640
2641 /* hash table stuff */
2642 a->ht = 0;
2643 a->hd = 0;
2644 a->ht_size = 0;
2645 a->ht_flag = oldmat->ht_flag;
2646 a->ht_fact = oldmat->ht_fact;
2647 a->ht_total_ct = 0;
2648 a->ht_insert_ct = 0;
2649
2650 ierr = PetscArraycpy(a->rangebs,oldmat->rangebs,a->size+2)((sizeof(*(a->rangebs)) != sizeof(*(oldmat->rangebs))) ||
PetscMemcpy(a->rangebs,oldmat->rangebs,(a->size+2)*
sizeof(*(a->rangebs))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2651 if (oldmat->colmap) {
2652#if defined(PETSC_USE_CTABLE1)
2653 ierr = PetscTableCreateCopy(oldmat->colmap,&a->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2653,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2654#else
2655 ierr = PetscMalloc1(a->Nbs,&a->colmap)PetscMallocA(1,PETSC_FALSE,2655,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(a->Nbs)*sizeof(**(&a->colmap)),(&a->
colmap))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2655,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2656 ierr = PetscLogObjectMemory((PetscObject)mat,(a->Nbs)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2656,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2657 ierr = PetscArraycpy(a->colmap,oldmat->colmap,a->Nbs)((sizeof(*(a->colmap)) != sizeof(*(oldmat->colmap))) ||
PetscMemcpy(a->colmap,oldmat->colmap,(a->Nbs)*sizeof
(*(a->colmap))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2657,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2658#endif
2659 } else a->colmap = 0;
2660
2661 if (oldmat->garray && (len = ((Mat_SeqBAIJ*)(oldmat->B->data))->nbs)) {
2662 ierr = PetscMalloc1(len,&a->garray)PetscMallocA(1,PETSC_FALSE,2662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(len)*sizeof(**(&a->garray)),(&a->garray
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2663 ierr = PetscLogObjectMemory((PetscObject)mat,len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2663,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2664 ierr = PetscArraycpy(a->garray,oldmat->garray,len)((sizeof(*(a->garray)) != sizeof(*(oldmat->garray))) ||
PetscMemcpy(a->garray,oldmat->garray,(len)*sizeof(*(a->
garray))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2664,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2665 } else a->garray = 0;
2666
2667 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)matin),matin->rmap->bs,&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2667,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2668 ierr = VecDuplicate(oldmat->lvec,&a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2668,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2669 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2670 ierr = VecScatterCopy(oldmat->Mvctx,&a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2670,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2671 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2671,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2672
2673 ierr = VecDuplicate(oldmat->slvec0,&a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2673,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2674 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2675 ierr = VecDuplicate(oldmat->slvec1,&a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2676 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2677
2678 ierr = VecGetLocalSize(a->slvec1,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2678,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2679 ierr = VecGetArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2679,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2680 ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,bs*mbs,array,&a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2680,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2681 ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,nt-bs*mbs,array+bs*mbs,&a->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2681,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2682 ierr = VecRestoreArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2683 ierr = VecGetArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2683,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2684 ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,nt-bs*mbs,array+bs*mbs,&a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2684,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2685 ierr = VecRestoreArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2685,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2686 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2687 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2687,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2688 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2689 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2689,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2690 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2691
2692 /* ierr = VecScatterCopy(oldmat->sMvctx,&a->sMvctx); - not written yet, replaced by the lazy trick: */
2693 ierr = PetscObjectReference((PetscObject)oldmat->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2694 a->sMvctx = oldmat->sMvctx;
2695 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2695,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2696
2697 ierr = MatDuplicate(oldmat->A,cpvalues,&a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2698 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2699 ierr = MatDuplicate(oldmat->B,cpvalues,&a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2700 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2700,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2701 ierr = PetscFunctionListDuplicate(((PetscObject)matin)->qlist,&((PetscObject)mat)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2702 *newmat = mat;
2703 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2704}
2705
2706PetscErrorCode MatLoad_MPISBAIJ(Mat newmat,PetscViewer viewer)
2707{
2708 PetscErrorCode ierr;
2709 PetscInt i,nz,j,rstart,rend;
2710 PetscScalar *vals,*buf;
2711 MPI_Comm comm;
2712 MPI_Status status;
2713 PetscMPIInt rank,size,tag = ((PetscObject)viewer)->tag,*sndcounts = 0,*browners,maxnz,*rowners,mmbs;
2714 PetscInt header[4],*rowlengths = 0,M,N,m,*cols,*locrowlens;
2715 PetscInt *procsnz = 0,jj,*mycols,*ibuf;
2716 PetscInt bs = newmat->rmap->bs,Mbs,mbs,extra_rows;
2717 PetscInt *dlens,*odlens,*mask,*masked1,*masked2,rowcount,odcount;
2718 PetscInt dcount,kmax,k,nzcount,tmp;
2719 int fd;
2720 PetscBool isbinary;
2721
2722 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2722; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2723 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2723,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2724 if (!isbinary) SETERRQ2(PetscObjectComm((PetscObject)newmat),PETSC_ERR_SUP,"Viewer type %s not yet supported for reading %s matrices",((PetscObject)viewer)->type_name,((PetscObject)newmat)->type_name)return PetscError(PetscObjectComm((PetscObject)newmat),2724,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Viewer type %s not yet supported for reading %s matrices"
,((PetscObject)viewer)->type_name,((PetscObject)newmat)->
type_name)
;
2725
2726 /* force binary viewer to load .info file if it has not yet done so */
2727 ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2727,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2728 ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2728,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2729 ierr = PetscOptionsBegin(comm,NULL,"Options for loading MPISBAIJ matrix 2","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems
*PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero
(PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject
->count=(PetscOptionsPublish?-1:1); PetscOptionsObject->
count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr
= PetscOptionsBegin_Private(PetscOptionsObject,comm,((void*)
0),"Options for loading MPISBAIJ matrix 2","Mat");do {if (__builtin_expect
(!!(_5_ierr),0)) return PetscError(((MPI_Comm)0x44000001),2729
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2729,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2730 ierr = PetscOptionsInt("-matload_block_size","Set the blocksize used to store the matrix","MatLoad",bs,&bs,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-matload_block_size"
,"Set the blocksize used to store the matrix","MatLoad",bs,&
bs,((void*)0),(-2147483647 - 1),2147483647)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2730,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2731 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2731,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2731,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2732 if (bs < 0) bs = 1;
2733
2734 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2735 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2735,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2736 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2736,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2737 if (!rank) {
2738 ierr = PetscBinaryRead(fd,(char*)header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2738,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2739 if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object")return PetscError(((MPI_Comm)0x44000001),2739,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"not matrix object")
;
2740 if (header[3] < 0) SETERRQ(PetscObjectComm((PetscObject)newmat),PETSC_ERR_FILE_UNEXPECTED,"Matrix stored in special format, cannot load as MPISBAIJ")return PetscError(PetscObjectComm((PetscObject)newmat),2740,__func__
,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"Matrix stored in special format, cannot load as MPISBAIJ"
)
;
2741 }
2742
2743 ierr = MPI_Bcast(header+1,3,MPIU_INT,0,comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Bcast
((header+1),(3),(((MPI_Datatype)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2743,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2744 M = header[1];
2745 N = header[2];
2746
2747 /* If global sizes are set, check if they are consistent with that given in the file */
2748 if (newmat->rmap->N >= 0 && newmat->rmap->N != M) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED, "Inconsistent # of rows:Matrix in file has (%D) and input matrix has (%D)",newmat->rmap->N,M)return PetscError(((MPI_Comm)0x44000001),2748,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"Inconsistent # of rows:Matrix in file has (%D) and input matrix has (%D)"
,newmat->rmap->N,M)
;
2749 if (newmat->cmap->N >= 0 && newmat->cmap->N != N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED, "Inconsistent # of cols:Matrix in file has (%D) and input matrix has (%D)",newmat->cmap->N,N)return PetscError(((MPI_Comm)0x44000001),2749,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"Inconsistent # of cols:Matrix in file has (%D) and input matrix has (%D)"
,newmat->cmap->N,N)
;
2750
2751 if (M != N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Can only do square matrices")return PetscError(((MPI_Comm)0x44000001),2751,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Can only do square matrices")
;
2752
2753 /*
2754 This code adds extra rows to make sure the number of rows is
2755 divisible by the blocksize
2756 */
2757 Mbs = M/bs;
2758 extra_rows = bs - M + bs*(Mbs);
2759 if (extra_rows == bs) extra_rows = 0;
2760 else Mbs++;
2761 if (extra_rows &&!rank) {
2762 ierr = PetscInfo(viewer,"Padding loaded matrix to match blocksize\n")PetscInfo_Private(__func__,viewer,"Padding loaded matrix to match blocksize\n"
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2762,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2763 }
2764
2765 /* determine ownership of all rows */
2766 if (newmat->rmap->n < 0) { /* PETSC_DECIDE */
2767 mbs = Mbs/size + ((Mbs % size) > rank);
2768 m = mbs*bs;
2769 } else { /* User Set */
2770 m = newmat->rmap->n;
2771 mbs = m/bs;
2772 }
2773 ierr = PetscMalloc2(size+1,&rowners,size+1,&browners)PetscMallocA(2,PETSC_FALSE,2773,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(size+1)*sizeof(**(&rowners)),(&rowners),(size_t
)(size+1)*sizeof(**(&browners)),(&browners))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2773,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2774 ierr = PetscMPIIntCast(mbs,&mmbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2774,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2775 ierr = MPI_Allgather(&mmbs,1,MPI_INT,rowners+1,1,MPI_INT,comm)((petsc_gather_ct += PetscMPIParallelComm((comm)),0) || MPI_Allgather
((&mmbs),(1),(((MPI_Datatype)0x4c000405)),(rowners+1),(1)
,(((MPI_Datatype)0x4c000405)),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2775,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2776 rowners[0] = 0;
2777 for (i=2; i<=size; i++) rowners[i] += rowners[i-1];
2778 for (i=0; i<=size; i++) browners[i] = rowners[i]*bs;
2779 rstart = rowners[rank];
2780 rend = rowners[rank+1];
2781
2782 /* distribute row lengths to all processors */
2783 ierr = PetscMalloc1((rend-rstart)*bs,&locrowlens)PetscMallocA(1,PETSC_FALSE,2783,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)((rend-rstart)*bs)*sizeof(**(&locrowlens)),(&
locrowlens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2783,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2784 if (!rank) {
2785 ierr = PetscMalloc1(M+extra_rows,&rowlengths)PetscMallocA(1,PETSC_FALSE,2785,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(M+extra_rows)*sizeof(**(&rowlengths)),(&rowlengths
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2785,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2786 ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2786,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2787 for (i=0; i<extra_rows; i++) rowlengths[M+i] = 1;
2788 ierr = PetscMalloc1(size,&sndcounts)PetscMallocA(1,PETSC_FALSE,2788,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(size)*sizeof(**(&sndcounts)),(&sndcounts))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2788,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2789 for (i=0; i<size; i++) sndcounts[i] = browners[i+1] - browners[i];
2790 ierr = MPI_Scatterv(rowlengths,sndcounts,browners,MPIU_INT,locrowlens,(rend-rstart)*bs,MPIU_INT,0,comm)((petsc_scatter_ct++,0) || PetscMPITypeSize(((rend-rstart)*bs
),(((MPI_Datatype)0x4c000405)),(&petsc_recv_len)) || MPI_Scatterv
((rowlengths),(sndcounts),(browners),(((MPI_Datatype)0x4c000405
)),(locrowlens),((rend-rstart)*bs),(((MPI_Datatype)0x4c000405
)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2790,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2791 ierr = PetscFree(sndcounts)((*PetscTrFree)((void*)(sndcounts),2791,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((sndcounts) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2791,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2792 } else {
2793 ierr = MPI_Scatterv(0,0,0,MPIU_INT,locrowlens,(rend-rstart)*bs,MPIU_INT,0,comm)((petsc_scatter_ct++,0) || PetscMPITypeSize(((rend-rstart)*bs
),(((MPI_Datatype)0x4c000405)),(&petsc_recv_len)) || MPI_Scatterv
((0),(0),(0),(((MPI_Datatype)0x4c000405)),(locrowlens),((rend
-rstart)*bs),(((MPI_Datatype)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2793,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2794 }
2795
2796 if (!rank) { /* procs[0] */
2797 /* calculate the number of nonzeros on each processor */
2798 ierr = PetscCalloc1(size,&procsnz)PetscMallocA(1,PETSC_TRUE,2798,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(size)*sizeof(**(&procsnz)),(&procsnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2798,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2799 for (i=0; i<size; i++) {
2800 for (j=rowners[i]*bs; j< rowners[i+1]*bs; j++) {
2801 procsnz[i] += rowlengths[j];
2802 }
2803 }
2804 ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((rowlengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2805
2806 /* determine max buffer needed and allocate it */
2807 maxnz = 0;
2808 for (i=0; i<size; i++) {
2809 maxnz = PetscMax(maxnz,procsnz[i])(((maxnz)<(procsnz[i])) ? (procsnz[i]) : (maxnz));
2810 }
2811 ierr = PetscMalloc1(maxnz,&cols)PetscMallocA(1,PETSC_FALSE,2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(maxnz)*sizeof(**(&cols)),(&cols))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2812
2813 /* read in my part of the matrix column indices */
2814 nz = procsnz[0];
2815 ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2815,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(nz)*sizeof(**(&ibuf)),(&ibuf))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2815,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2816 mycols = ibuf;
2817 if (size == 1) nz -= extra_rows;
2818 ierr = PetscBinaryRead(fd,mycols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2818,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2819 if (size == 1) {
2820 for (i=0; i< extra_rows; i++) mycols[nz+i] = M+i;
2821 }
2822
2823 /* read in every ones (except the last) and ship off */
2824 for (i=1; i<size-1; i++) {
2825 nz = procsnz[i];
2826 ierr = PetscBinaryRead(fd,cols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2826,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2827 ierr = MPI_Send(cols,nz,MPIU_INT,i,tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((nz),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Send((cols),(nz),
(((MPI_Datatype)0x4c000405)),(i),(tag),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2827,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2828 }
2829 /* read in the stuff for the last proc */
2830 if (size != 1) {
2831 nz = procsnz[size-1] - extra_rows; /* the extra rows are not on the disk */
2832 ierr = PetscBinaryRead(fd,cols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2832,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2833 for (i=0; i<extra_rows; i++) cols[nz+i] = M+i;
2834 ierr = MPI_Send(cols,nz+extra_rows,MPIU_INT,size-1,tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((nz+extra_rows),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Send((cols),(nz+extra_rows
),(((MPI_Datatype)0x4c000405)),(size-1),(tag),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2835 }
2836 ierr = PetscFree(cols)((*PetscTrFree)((void*)(cols),2836,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((cols) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2836,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2837 } else { /* procs[i], i>0 */
2838 /* determine buffer space needed for message */
2839 nz = 0;
2840 for (i=0; i<m; i++) nz += locrowlens[i];
2841 ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2841,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(nz)*sizeof(**(&ibuf)),(&ibuf))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2841,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2842 mycols = ibuf;
2843 /* receive message of column indices*/
2844 ierr = MPI_Recv(mycols,nz,MPIU_INT,0,tag,comm,&status)((petsc_recv_ct++,0) || PetscMPITypeSize((nz),(((MPI_Datatype
)0x4c000405)),(&petsc_recv_len)) || MPI_Recv((mycols),(nz
),(((MPI_Datatype)0x4c000405)),(0),(tag),(comm),(&status)
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2844,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2845 ierr = MPI_Get_count(&status,MPIU_INT((MPI_Datatype)0x4c000405),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2845,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2846 if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2846,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"something is wrong with file")
;
2847 }
2848
2849 /* loop over local rows, determining number of off diagonal entries */
2850 ierr = PetscMalloc2(rend-rstart,&dlens,rend-rstart,&odlens)PetscMallocA(2,PETSC_FALSE,2850,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(rend-rstart)*sizeof(**(&dlens)),(&dlens),(size_t
)(rend-rstart)*sizeof(**(&odlens)),(&odlens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2850,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2851 ierr = PetscCalloc3(Mbs,&mask,Mbs,&masked1,Mbs,&masked2)PetscMallocA(3,PETSC_TRUE,2851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(Mbs)*sizeof(**(&mask)),(&mask),(size_t)(Mbs
)*sizeof(**(&masked1)),(&masked1),(size_t)(Mbs)*sizeof
(**(&masked2)),(&masked2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2852 rowcount = 0;
2853 nzcount = 0;
2854 for (i=0; i<mbs; i++) {
2855 dcount = 0;
2856 odcount = 0;
2857 for (j=0; j<bs; j++) {
2858 kmax = locrowlens[rowcount];
2859 for (k=0; k<kmax; k++) {
2860 tmp = mycols[nzcount++]/bs; /* block col. index */
2861 if (!mask[tmp]) {
2862 mask[tmp] = 1;
2863 if (tmp < rstart || tmp >= rend) masked2[odcount++] = tmp; /* entry in off-diag portion */
2864 else masked1[dcount++] = tmp; /* entry in diag portion */
2865 }
2866 }
2867 rowcount++;
2868 }
2869
2870 dlens[i] = dcount; /* d_nzz[i] */
2871 odlens[i] = odcount; /* o_nzz[i] */
2872
2873 /* zero out the mask elements we set */
2874 for (j=0; j<dcount; j++) mask[masked1[j]] = 0;
2875 for (j=0; j<odcount; j++) mask[masked2[j]] = 0;
2876 }
2877 ierr = MatSetSizes(newmat,m,m,M+extra_rows,N+extra_rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2878 ierr = MatMPISBAIJSetPreallocation(newmat,bs,0,dlens,0,odlens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2878,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2879 ierr = MatSetOption(newmat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2879,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2880
2881 if (!rank) {
2882 ierr = PetscMalloc1(maxnz,&buf)PetscMallocA(1,PETSC_FALSE,2882,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(maxnz)*sizeof(**(&buf)),(&buf))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2882,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2883 /* read in my part of the matrix numerical values */
2884 nz = procsnz[0];
2885 vals = buf;
2886 mycols = ibuf;
2887 if (size == 1) nz -= extra_rows;
2888 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2888,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2889 if (size == 1) {
2890 for (i=0; i< extra_rows; i++) vals[nz+i] = 1.0;
2891 }
2892
2893 /* insert into matrix */
2894 jj = rstart*bs;
2895 for (i=0; i<m; i++) {
2896 ierr = MatSetValues(newmat,1,&jj,locrowlens[i],mycols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2896,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2897 mycols += locrowlens[i];
2898 vals += locrowlens[i];
2899 jj++;
2900 }
2901
2902 /* read in other processors (except the last one) and ship out */
2903 for (i=1; i<size-1; i++) {
2904 nz = procsnz[i];
2905 vals = buf;
2906 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2907 ierr = MPI_Send(vals,nz,MPIU_SCALAR,i,((PetscObject)newmat)->tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((nz),(((MPI_Datatype
)0x4c00080b)),(&petsc_send_len)) || MPI_Send((vals),(nz),
(((MPI_Datatype)0x4c00080b)),(i),(((PetscObject)newmat)->tag
),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2907,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2908 }
2909 /* the last proc */
2910 if (size != 1) {
2911 nz = procsnz[i] - extra_rows;
2912 vals = buf;
2913 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2913,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2914 for (i=0; i<extra_rows; i++) vals[nz+i] = 1.0;
2915 ierr = MPI_Send(vals,nz+extra_rows,MPIU_SCALAR,size-1,((PetscObject)newmat)->tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((nz+extra_rows),(((MPI_Datatype
)0x4c00080b)),(&petsc_send_len)) || MPI_Send((vals),(nz+extra_rows
),(((MPI_Datatype)0x4c00080b)),(size-1),(((PetscObject)newmat
)->tag),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2916 }
2917 ierr = PetscFree(procsnz)((*PetscTrFree)((void*)(procsnz),2917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((procsnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2918
2919 } else {
2920 /* receive numeric values */
2921 ierr = PetscMalloc1(nz,&buf)PetscMallocA(1,PETSC_FALSE,2921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(nz)*sizeof(**(&buf)),(&buf))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2922
2923 /* receive message of values*/
2924 vals = buf;
2925 mycols = ibuf;
2926 ierr = MPI_Recv(vals,nz,MPIU_SCALAR,0,((PetscObject)newmat)->tag,comm,&status)((petsc_recv_ct++,0) || PetscMPITypeSize((nz),(((MPI_Datatype
)0x4c00080b)),(&petsc_recv_len)) || MPI_Recv((vals),(nz),
(((MPI_Datatype)0x4c00080b)),(0),(((PetscObject)newmat)->tag
),(comm),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2926,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2927 ierr = MPI_Get_count(&status,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2927,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2928 if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2928,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"something is wrong with file")
;
2929
2930 /* insert into matrix */
2931 jj = rstart*bs;
2932 for (i=0; i<m; i++) {
2933 ierr = MatSetValues_MPISBAIJ(newmat,1,&jj,locrowlens[i],mycols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2934 mycols += locrowlens[i];
2935 vals += locrowlens[i];
2936 jj++;
2937 }
2938 }
2939
2940 ierr = PetscFree(locrowlens)((*PetscTrFree)((void*)(locrowlens),2940,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((locrowlens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2940,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2941 ierr = PetscFree(buf)((*PetscTrFree)((void*)(buf),2941,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((buf) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2941,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2942 ierr = PetscFree(ibuf)((*PetscTrFree)((void*)(ibuf),2942,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((ibuf) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2942,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2943 ierr = PetscFree2(rowners,browners)PetscFreeA(2,2943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(rowners),&(browners))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2944 ierr = PetscFree2(dlens,odlens)PetscFreeA(2,2944,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(dlens),&(odlens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2944,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2945 ierr = PetscFree3(mask,masked1,masked2)PetscFreeA(3,2945,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(mask),&(masked1),&(masked2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2945,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2946 ierr = MatAssemblyBegin(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2946,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2947 ierr = MatAssemblyEnd(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2947,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2948 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2949}
2950
2951/*XXXXX@
2952 MatMPISBAIJSetHashTableFactor - Sets the factor required to compute the size of the HashTable.
2953
2954 Input Parameters:
2955. mat - the matrix
2956. fact - factor
2957
2958 Not Collective on Mat, each process can have a different hash factor
2959
2960 Level: advanced
2961
2962 Notes:
2963 This can also be set by the command line option: -mat_use_hash_table fact
2964
2965.seealso: MatSetOption()
2966@XXXXX*/
2967
2968
2969PetscErrorCode MatGetRowMaxAbs_MPISBAIJ(Mat A,Vec v,PetscInt idx[])
2970{
2971 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
2972 Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)(a->B)->data;
2973 PetscReal atmp;
2974 PetscReal *work,*svalues,*rvalues;
2975 PetscErrorCode ierr;
2976 PetscInt i,bs,mbs,*bi,*bj,brow,j,ncols,krow,kcol,col,row,Mbs,bcol;
2977 PetscMPIInt rank,size;
2978 PetscInt *rowners_bs,dest,count,source;
2979 PetscScalar *va;
2980 MatScalar *ba;
2981 MPI_Status stat;
2982
2983 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2983; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2984 if (idx) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Send email to [email protected]")return PetscError(((MPI_Comm)0x44000001),2984,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Send email to [email protected]"
)
;
2985 ierr = MatGetRowMaxAbs(a->A,v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2985,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2986 ierr = VecGetArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2986,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2987
2988 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2988,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2989 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2989,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2990
2991 bs = A->rmap->bs;
2992 mbs = a->mbs;
2993 Mbs = a->Mbs;
2994 ba = b->a;
2995 bi = b->i;
2996 bj = b->j;
2997
2998 /* find ownerships */
2999 rowners_bs = A->rmap->range;
3000
3001 /* each proc creates an array to be distributed */
3002 ierr = PetscCalloc1(bs*Mbs,&work)PetscMallocA(1,PETSC_TRUE,3002,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs*Mbs)*sizeof(**(&work)),(&work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3002,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3003
3004 /* row_max for B */
3005 if (rank != size-1) {
3006 for (i=0; i<mbs; i++) {
3007 ncols = bi[1] - bi[0]; bi++;
3008 brow = bs*i;
3009 for (j=0; j<ncols; j++) {
3010 bcol = bs*(*bj);
3011 for (kcol=0; kcol<bs; kcol++) {
3012 col = bcol + kcol; /* local col index */
3013 col += rowners_bs[rank+1]; /* global col index */
3014 for (krow=0; krow<bs; krow++) {
3015 atmp = PetscAbsScalar(*ba); ba++;
3016 row = brow + krow; /* local row index */
3017 if (PetscRealPart(va[row])(va[row]) < atmp) va[row] = atmp;
3018 if (work[col] < atmp) work[col] = atmp;
3019 }
3020 }
3021 bj++;
3022 }
3023 }
3024
3025 /* send values to its owners */
3026 for (dest=rank+1; dest<size; dest++) {
3027 svalues = work + rowners_bs[dest];
3028 count = rowners_bs[dest+1]-rowners_bs[dest];
3029 ierr = MPI_Send(svalues,count,MPIU_REAL,dest,rank,PetscObjectComm((PetscObject)A))((petsc_send_ct++,0) || PetscMPITypeSize((count),(((MPI_Datatype
)0x4c00080b)),(&petsc_send_len)) || MPI_Send((svalues),(count
),(((MPI_Datatype)0x4c00080b)),(dest),(rank),(PetscObjectComm
((PetscObject)A))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3029,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3030 }
3031 }
3032
3033 /* receive values */
3034 if (rank) {
3035 rvalues = work;
3036 count = rowners_bs[rank+1]-rowners_bs[rank];
3037 for (source=0; source<rank; source++) {
3038 ierr = MPI_Recv(rvalues,count,MPIU_REAL,MPI_ANY_SOURCE,MPI_ANY_TAG,PetscObjectComm((PetscObject)A),&stat)((petsc_recv_ct++,0) || PetscMPITypeSize((count),(((MPI_Datatype
)0x4c00080b)),(&petsc_recv_len)) || MPI_Recv((rvalues),(count
),(((MPI_Datatype)0x4c00080b)),((-2)),((-1)),(PetscObjectComm
((PetscObject)A)),(&stat)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3038,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3039 /* process values */
3040 for (i=0; i<count; i++) {
3041 if (PetscRealPart(va[i])(va[i]) < rvalues[i]) va[i] = rvalues[i];
3042 }
3043 }
3044 }
3045
3046 ierr = VecRestoreArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3046,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3047 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),3047,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3047,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3048 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3049}
3050
3051PetscErrorCode MatSOR_MPISBAIJ(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
3052{
3053 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
3054 PetscErrorCode ierr;
3055 PetscInt mbs=mat->mbs,bs=matin->rmap->bs;
3056 PetscScalar *x,*ptr,*from;
3057 Vec bb1;
3058 const PetscScalar *b;
3059
3060 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3060; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3061 if (its <= 0 || lits <= 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Relaxation requires global its %D and local its %D both positive",its,lits)return PetscError(((MPI_Comm)0x44000001),3061,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive"
,its,lits)
;
3062 if (bs > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SSOR for block size > 1 is not yet implemented")return PetscError(((MPI_Comm)0x44000001),3062,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented"
)
;
3063
3064 if (flag == SOR_APPLY_UPPER) {
3065 ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3065,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3066 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3067 }
3068
3069 if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) {
3070 if (flag & SOR_ZERO_INITIAL_GUESS) {
3071 ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3071,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3072 its--;
3073 }
3074
3075 ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3075,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3076 while (its--) {
3077
3078 /* lower triangular part: slvec0b = - B^T*xx */
3079 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3079,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3080
3081 /* copy xx into slvec0a */
3082 ierr = VecGetArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3082,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3083 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3083,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3084 ierr = PetscArraycpy(ptr,x,bs*mbs)((sizeof(*(ptr)) != sizeof(*(x))) || PetscMemcpy(ptr,x,(bs*mbs
)*sizeof(*(ptr))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3084,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3085 ierr = VecRestoreArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3086
3087 ierr = VecScale(mat->slvec0,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3087,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3088
3089 /* copy bb into slvec1a */
3090 ierr = VecGetArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3090,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3091 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3091,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3092 ierr = PetscArraycpy(ptr,b,bs*mbs)((sizeof(*(ptr)) != sizeof(*(b))) || PetscMemcpy(ptr,b,(bs*mbs
)*sizeof(*(ptr))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3092,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3093 ierr = VecRestoreArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3093,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3094
3095 /* set slvec1b = 0 */
3096 ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3096,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3097
3098 ierr = VecScatterBegin(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3099 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3099,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3100 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3101 ierr = VecScatterEnd(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3102
3103 /* upper triangular part: bb1 = bb1 - B*x */
3104 ierr = (*mat->B->ops->multadd)(mat->B,mat->slvec1b,mat->slvec1a,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3104,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3105
3106 /* local diagonal sweep */
3107 ierr = (*mat->A->ops->sor)(mat->A,bb1,omega,SOR_SYMMETRIC_SWEEP,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3107,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3108 }
3109 ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3110 } else if ((flag & SOR_LOCAL_FORWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) {
3111 ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3111,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3112 } else if ((flag & SOR_LOCAL_BACKWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) {
3113 ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3113,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3114 } else if (flag & SOR_EISENSTAT) {
3115 Vec xx1;
3116 PetscBool hasop;
3117 const PetscScalar *diag;
3118 PetscScalar *sl,scale = (omega - 2.0)/omega;
3119 PetscInt i,n;
3120
3121 if (!mat->xx1) {
3122 ierr = VecDuplicate(bb,&mat->xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3123 ierr = VecDuplicate(bb,&mat->bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3124 }
3125 xx1 = mat->xx1;
3126 bb1 = mat->bb1;
3127
3128 ierr = (*mat->A->ops->sor)(mat->A,bb,omega,(MatSORType)(SOR_ZERO_INITIAL_GUESS | SOR_LOCAL_BACKWARD_SWEEP),fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3128,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3129
3130 if (!mat->diag) {
3131 /* this is wrong for same matrix with new nonzero values */
3132 ierr = MatCreateVecs(matin,&mat->diag,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3132,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3133 ierr = MatGetDiagonal(matin,mat->diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3133,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3134 }
3135 ierr = MatHasOperation(matin,MATOP_MULT_DIAGONAL_BLOCK,&hasop);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3135,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3136
3137 if (hasop) {
3138 ierr = MatMultDiagonalBlock(matin,xx,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3138,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3139 ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3140 } else {
3141 /*
3142 These two lines are replaced by code that may be a bit faster for a good compiler
3143 ierr = VecPointwiseMult(mat->slvec1a,mat->diag,xx);CHKERRQ(ierr);
3144 ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr);
3145 */
3146 ierr = VecGetArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3147 ierr = VecGetArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3147,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3148 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3149 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3149,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3150 ierr = VecGetLocalSize(xx,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3150,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3151 if (omega == 1.0) {
3152 for (i=0; i<n; i++) sl[i] = b[i] - diag[i]*x[i];
3153 ierr = PetscLogFlops(2.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3154 } else {
3155 for (i=0; i<n; i++) sl[i] = b[i] + scale*diag[i]*x[i];
3156 ierr = PetscLogFlops(3.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3156,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3157 }
3158 ierr = VecRestoreArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3158,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3159 ierr = VecRestoreArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3160 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3161 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3162 }
3163
3164 /* multiply off-diagonal portion of matrix */
3165 ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3166 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3166,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3167 ierr = VecGetArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3168 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3168,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3169 ierr = PetscArraycpy(from,x,bs*mbs)((sizeof(*(from)) != sizeof(*(x))) || PetscMemcpy(from,x,(bs*
mbs)*sizeof(*(from))));
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3170 ierr = VecRestoreArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3170,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3171 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3172 ierr = VecScatterBegin(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3172,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3173 ierr = VecScatterEnd(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3173,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3174 ierr = (*mat->B->ops->multadd)(mat->B,mat->slvec1b,mat->slvec1a,mat->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3174,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3175
3176 /* local sweep */
3177 ierr = (*mat->A->ops->sor)(mat->A,mat->slvec1a,omega,(MatSORType)(SOR_ZERO_INITIAL_GUESS | SOR_LOCAL_FORWARD_SWEEP),fshift,lits,1,xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3177,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3178 ierr = VecAXPY(xx,1.0,xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3179 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format"
)
;
3180 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3181}
3182
3183PetscErrorCode MatSOR_MPISBAIJ_2comm(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
3184{
3185 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
3186 PetscErrorCode ierr;
3187 Vec lvec1,bb1;
3188
3189 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3189; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3190 if (its <= 0 || lits <= 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Relaxation requires global its %D and local its %D both positive",its,lits)return PetscError(((MPI_Comm)0x44000001),3190,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive"
,its,lits)
;
3191 if (matin->rmap->bs > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SSOR for block size > 1 is not yet implemented")return PetscError(((MPI_Comm)0x44000001),3191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented"
)
;
3192
3193 if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) {
3194 if (flag & SOR_ZERO_INITIAL_GUESS) {
3195 ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3195,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3196 its--;
3197 }
3198
3199 ierr = VecDuplicate(mat->lvec,&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3200 ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3201 while (its--) {
3202 ierr = VecScatterBegin(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3203
3204 /* lower diagonal part: bb1 = bb - B^T*xx */
3205 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3206 ierr = VecScale(lvec1,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3207
3208 ierr = VecScatterEnd(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3209 ierr = VecCopy(bb,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3210 ierr = VecScatterBegin(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3210,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3211
3212 /* upper diagonal part: bb1 = bb1 - B*x */
3213 ierr = VecScale(mat->lvec,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3214 ierr = (*mat->B->ops->multadd)(mat->B,mat->lvec,bb1,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3214,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3215
3216 ierr = VecScatterEnd(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3217
3218 /* diagonal sweep */
3219 ierr = (*mat->A->ops->sor)(mat->A,bb1,omega,SOR_SYMMETRIC_SWEEP,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3220 }
3221 ierr = VecDestroy(&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3222 ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3223 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3223,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format"
)
;
3224 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3225}
3226
3227/*@
3228 MatCreateMPISBAIJWithArrays - creates a MPI SBAIJ matrix using arrays that contain in standard
3229 CSR format the local rows.
3230
3231 Collective
3232
3233 Input Parameters:
3234+ comm - MPI communicator
3235. bs - the block size, only a block size of 1 is supported
3236. m - number of local rows (Cannot be PETSC_DECIDE)
3237. n - This value should be the same as the local size used in creating the
3238 x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have
3239 calculated if N is given) For square matrices n is almost always m.
3240. M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
3241. N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
3242. i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that row block row of the matrix
3243. j - column indices
3244- a - matrix values
3245
3246 Output Parameter:
3247. mat - the matrix
3248
3249 Level: intermediate
3250
3251 Notes:
3252 The i, j, and a arrays ARE copied by this routine into the internal format used by PETSc;
3253 thus you CANNOT change the matrix entries by changing the values of a[] after you have
3254 called this routine. Use MatCreateMPIAIJWithSplitArrays() to avoid needing to copy the arrays.
3255
3256 The i and j indices are 0 based, and i indices are indices corresponding to the local j array.
3257
3258.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(),
3259 MPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays()
3260@*/
3261PetscErrorCode MatCreateMPISBAIJWithArrays(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt i[],const PetscInt j[],const PetscScalar a[],Mat *mat)
3262{
3263 PetscErrorCode ierr;
3264
3265
3266 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3266; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3267 if (i[0]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"i (row indices) must start with 0")return PetscError(((MPI_Comm)0x44000001),3267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0")
;
3268 if (m < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"local number of rows (m) cannot be PETSC_DECIDE, or negative")return PetscError(((MPI_Comm)0x44000001),3268,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"local number of rows (m) cannot be PETSC_DECIDE, or negative"
)
;
3269 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3269,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3270 ierr = MatSetSizes(*mat,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3270,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3271 ierr = MatSetType(*mat,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3272 ierr = MatMPISBAIJSetPreallocationCSR(*mat,bs,i,j,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3273 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3274}
3275
3276
3277/*@C
3278 MatMPISBAIJSetPreallocationCSR - Allocates memory for a sparse parallel matrix in BAIJ format
3279 (the default parallel PETSc format).
3280
3281 Collective
3282
3283 Input Parameters:
3284+ B - the matrix
3285. bs - the block size
3286. i - the indices into j for the start of each local row (starts with zero)
3287. j - the column indices for each local row (starts with zero) these must be sorted for each row
3288- v - optional values in the matrix
3289
3290 Level: developer
3291
3292.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MPIAIJ
3293@*/
3294PetscErrorCode MatMPISBAIJSetPreallocationCSR(Mat B,PetscInt bs,const PetscInt i[],const PetscInt j[], const PetscScalar v[])
3295{
3296 PetscErrorCode ierr;
3297
3298 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3298; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3299 ierr = PetscTryMethod(B,"MatMPISBAIJSetPreallocationCSR_C",(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,bs,i,j,v))0; do { PetscErrorCode (*f)(Mat,PetscInt,const PetscInt[],const
PetscInt[],const PetscScalar[]), __ierr; __ierr = PetscObjectQueryFunction_Private
(((PetscObject)B),("MatMPISBAIJSetPreallocationCSR_C"),(PetscVoidFunction
*)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError
(((MPI_Comm)0x44000001),3299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(B,bs,i,j,v);do {if (__builtin_expect(!!(__ierr),0)) return
PetscError(((MPI_Comm)0x44000001),3299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3300 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3301}
3302
3303PetscErrorCode MatCreateMPIMatConcatenateSeqMat_MPISBAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat)
3304{
3305 PetscErrorCode ierr;
3306 PetscInt m,N,i,rstart,nnz,Ii,bs,cbs;
3307 PetscInt *indx;
3308 PetscScalar *values;
3309
3310 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3310; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3311 ierr = MatGetSize(inmat,&m,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3311,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3312 if (scall == MAT_INITIAL_MATRIX) { /* symbolic phase */
3313 Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)inmat->data;
3314 PetscInt *dnz,*onz,sum,bs,cbs,mbs,Nbs;
3315 PetscInt *bindx,rmax=a->rmax,j;
3316
3317 ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3317,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3318 mbs = m/bs; Nbs = N/cbs;
3319 if (n == PETSC_DECIDE-1) {
3320 ierr = PetscSplitOwnership(comm,&n,&Nbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3320,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3321 }
3322 /* Check sum(n) = Nbs */
3323 ierr = MPIU_Allreduce(&n,&sum,1,MPIU_INT,MPI_SUM,comm)(PetscAllreduceBarrierCheck(comm,1,3323,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) ||
MPI_Allreduce((&n),(&sum),(1),(((MPI_Datatype)0x4c000405
)),((MPI_Op)(0x58000003)),(comm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3323,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3324 if (sum != Nbs) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Sum of local columns != global columns %d",Nbs)return PetscError(((MPI_Comm)0x44000001),3324,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,75,PETSC_ERROR_INITIAL,"Sum of local columns != global columns %d"
,Nbs)
;
3325
3326 ierr = MPI_Scan(&mbs, &rstart,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3326,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3327 rstart -= mbs;
3328
3329 ierr = PetscMalloc1(rmax,&bindx)PetscMallocA(1,PETSC_FALSE,3329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(rmax)*sizeof(**(&bindx)),(&bindx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3330 ierr = MatPreallocateInitialize(comm,mbs,n,dnz,onz)0; do { PetscErrorCode _4_ierr; PetscInt __nrows = (mbs),__ncols
= (n),__rstart,__start,__end; _4_ierr = PetscMallocA(2,PETSC_TRUE
,3330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)((size_t)__nrows)*sizeof(**(&dnz)),(&dnz),(size_t
)((size_t)__nrows)*sizeof(**(&onz)),(&onz));do {if (__builtin_expect
(!!(_4_ierr),0)) return PetscError(((MPI_Comm)0x44000001),3330
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0); __start = 0; __end
= __start; _4_ierr = MPI_Scan(&__ncols,&__end,1,((MPI_Datatype
)0x4c000405),(MPI_Op)(0x58000003),comm);do {if (__builtin_expect
(!!(_4_ierr),0)) return PetscError(((MPI_Comm)0x44000001),3330
,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0); __start = __end
- __ncols; _4_ierr = MPI_Scan(&__nrows,&__rstart,1,(
(MPI_Datatype)0x4c000405),(MPI_Op)(0x58000003),comm);do {if (
__builtin_expect(!!(_4_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0); __rstart = __rstart
- __nrows; do { } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3330,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3331 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3331,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3332 for (i=0; i<mbs; i++) {
3333 ierr = MatGetRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3333,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* non-blocked nnz and indx */
3334 nnz = nnz/bs;
3335 for (j=0; j<nnz; j++) bindx[j] = indx[j*bs]/bs;
3336 ierr = MatPreallocateSet(i+rstart,nnz,bindx,dnz,onz)0;do { PetscInt __i; if (i+rstart < __rstart) return PetscError
(((MPI_Comm)0x44000001),3336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Trying to set preallocation for row %D less than first local row %D"
,i+rstart,__rstart); if (i+rstart >= __rstart+__nrows) return
PetscError(((MPI_Comm)0x44000001),3336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Trying to set preallocation for row %D greater than last local row %D"
,i+rstart,__rstart+__nrows-1); for (__i=0; __i<nnz; __i++)
{ if ((bindx)[__i] < __start || (bindx)[__i] >= __end)
onz[i+rstart - __rstart]++; else if (dnz[i+rstart - __rstart
] < __ncols) dnz[i+rstart - __rstart]++; }} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3336,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3337 ierr = MatRestoreRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3337,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3338 }
3339 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3339,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3340 ierr = PetscFree(bindx)((*PetscTrFree)((void*)(bindx),3340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((bindx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3340,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3341
3342 ierr = MatCreate(comm,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3342,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3343 ierr = MatSetSizes(*outmat,m,n*bs,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3343,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3344 ierr = MatSetBlockSizes(*outmat,bs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3344,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3345 ierr = MatSetType(*outmat,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3345,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3346 ierr = MatMPISBAIJSetPreallocation(*outmat,bs,0,dnz,0,onz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3346,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3347 ierr = MatPreallocateFinalize(dnz,onz)0;_4_ierr = PetscFreeA(2,3347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(dnz),&(onz));do {if (__builtin_expect(!!(_4_ierr),
0)) return PetscError(((MPI_Comm)0x44000001),3347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3348 }
3349
3350 /* numeric phase */
3351 ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3351,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3352 ierr = MatGetOwnershipRange(*outmat,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3353
3354 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3354,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3355 for (i=0; i<m; i++) {
3356 ierr = MatGetRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3356,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3357 Ii = i + rstart;
3358 ierr = MatSetValues(*outmat,1,&Ii,nnz,indx,values,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3359 ierr = MatRestoreRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3359,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3360 }
3361 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3362 ierr = MatAssemblyBegin(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3362,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3363 ierr = MatAssemblyEnd(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3364 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3365}

/sandbox/petsc/petsc.next-tmp/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)));
28
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);
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)return PetscError(((MPI_Comm)0x44000001),46,__func__,"/sandbox/petsc/petsc.next-tmp/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-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)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/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-tmp/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-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)return PetscError(((MPI_Comm)0x44000001),93,__func__,"/sandbox/petsc/petsc.next-tmp/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-tmp/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-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*/
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);
27
Calling 'PetscHashStep'
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)return PetscError(((MPI_Comm)0x44000001),129,__func__,"/sandbox/petsc/petsc.next-tmp/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