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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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 or generates an error
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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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->cstartbs,stepval;
519 PetscInt cend=baij->cendbs,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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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)fabs(*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.master/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)fabs(*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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1220 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatMPISBAIJSetPreallocationCSR_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatMPISBAIJSetPreallocationCSR_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1220,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1221#if defined(PETSC_HAVE_ELEMENTAL)
1222 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),1222,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1223#endif
1224 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),1224,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1225 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),1225,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1226 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1227}
1228
1229PetscErrorCode MatMult_MPISBAIJ_Hermitian(Mat A,Vec xx,Vec yy)
1230{
1231 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1232 PetscErrorCode ierr;
1233 PetscInt nt,mbs=a->mbs,bs=A->rmap->bs;
1234 PetscScalar *from;
1235 const PetscScalar *x;
1236
1237 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1237; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1238 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1238,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1239 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1239,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1240
1241 /* diagonal part */
1242 ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1242,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1243 ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1243,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1244
1245 /* subdiagonal part */
1246 ierr = (*a->B->ops->multhermitiantranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1246,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1247
1248 /* copy x into the vec slvec0 */
1249 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1249,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1250 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1250,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1251
1252 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),1252,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1253 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1253,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1254 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1254,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1255
1256 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),1256,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1257 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),1257,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1258 /* supperdiagonal part */
1259 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),1259,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1260 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1261}
1262
1263PetscErrorCode MatMult_MPISBAIJ(Mat A,Vec xx,Vec yy)
1264{
1265 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1266 PetscErrorCode ierr;
1267 PetscInt nt,mbs=a->mbs,bs=A->rmap->bs;
1268 PetscScalar *from;
1269 const PetscScalar *x;
1270
1271 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1271; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1272 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1272,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1273 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1273,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1274
1275 /* diagonal part */
1276 ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1276,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1277 ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1277,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1278
1279 /* subdiagonal part */
1280 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1280,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1281
1282 /* copy x into the vec slvec0 */
1283 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1283,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1284 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1284,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1285
1286 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),1286,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1287 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1287,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1288 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1288,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1289
1290 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),1290,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1291 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),1291,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1292 /* supperdiagonal part */
1293 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),1293,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1294 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1295}
1296
1297PetscErrorCode MatMult_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy)
1298{
1299 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1300 PetscErrorCode ierr;
1301 PetscInt nt;
1302
1303 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1303; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1304 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1304,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1305 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1305,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1306
1307 ierr = VecGetLocalSize(yy,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1307,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1308 if (nt != A->rmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible parition of A and yy")return PetscError(((MPI_Comm)0x44000001),1308,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible parition of A and yy")
;
1309
1310 ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1310,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1311 /* do diagonal part */
1312 ierr = (*a->A->ops->mult)(a->A,xx,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1312,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1313 /* do supperdiagonal part */
1314 ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1314,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1315 ierr = (*a->B->ops->multadd)(a->B,a->lvec,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1315,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1316 /* do subdiagonal part */
1317 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1317,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1318 ierr = VecScatterBegin(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.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1319 ierr = VecScatterEnd(a->Mvctx,a->lvec,yy,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1319,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1320 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1321}
1322
1323PetscErrorCode MatMultAdd_MPISBAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1324{
1325 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1326 PetscErrorCode ierr;
1327 PetscInt mbs=a->mbs,bs=A->rmap->bs;
1328 PetscScalar *from,zero=0.0;
1329 const PetscScalar *x;
1330
1331 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1331; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1332 /*
1333 PetscSynchronizedPrintf(PetscObjectComm((PetscObject)A)," MatMultAdd is called ...\n");
1334 PetscSynchronizedFlush(PetscObjectComm((PetscObject)A),PETSC_STDOUT);
1335 */
1336 /* diagonal part */
1337 ierr = (*a->A->ops->multadd)(a->A,xx,yy,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1337,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1338 ierr = VecSet(a->slvec1b,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1338,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1339
1340 /* subdiagonal part */
1341 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1341,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1342
1343 /* copy x into the vec slvec0 */
1344 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1344,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1345 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1345,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1346 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),1346,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1347 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1347,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1348
1349 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),1349,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1350 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1350,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1351 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),1351,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1352
1353 /* supperdiagonal part */
1354 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),1354,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1355 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1356}
1357
1358PetscErrorCode MatMultAdd_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy,Vec zz)
1359{
1360 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1361 PetscErrorCode ierr;
1362
1363 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1363; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1364 ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1364,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1365 /* do diagonal part */
1366 ierr = (*a->A->ops->multadd)(a->A,xx,yy,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1366,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1367 /* do supperdiagonal part */
1368 ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1368,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1369 ierr = (*a->B->ops->multadd)(a->B,a->lvec,zz,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1369,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1370
1371 /* do subdiagonal part */
1372 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1372,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1373 ierr = VecScatterBegin(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.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1374 ierr = VecScatterEnd(a->Mvctx,a->lvec,zz,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1374,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1375 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1376}
1377
1378/*
1379 This only works correctly for square matrices where the subblock A->A is the
1380 diagonal block
1381*/
1382PetscErrorCode MatGetDiagonal_MPISBAIJ(Mat A,Vec v)
1383{
1384 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1385 PetscErrorCode ierr;
1386
1387 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1387; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1388 /* if (a->rmap->N != a->cmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Supports only square matrix where A->A is diag block"); */
1389 ierr = MatGetDiagonal(a->A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1389,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1390 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1391}
1392
1393PetscErrorCode MatScale_MPISBAIJ(Mat A,PetscScalar aa)
1394{
1395 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1396 PetscErrorCode ierr;
1397
1398 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1398; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1399 ierr = MatScale(a->A,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1399,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1400 ierr = MatScale(a->B,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1400,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1401 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1402}
1403
1404PetscErrorCode MatGetRow_MPISBAIJ(Mat matin,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1405{
1406 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
1407 PetscScalar *vworkA,*vworkB,**pvA,**pvB,*v_p;
1408 PetscErrorCode ierr;
1409 PetscInt bs = matin->rmap->bs,bs2 = mat->bs2,i,*cworkA,*cworkB,**pcA,**pcB;
1410 PetscInt nztot,nzA,nzB,lrow,brstart = matin->rmap->rstart,brend = matin->rmap->rend;
1411 PetscInt *cmap,*idx_p,cstart = mat->rstartbs;
1412
1413 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1413; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1414 if (mat->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Already active")return PetscError(((MPI_Comm)0x44000001),1414,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Already active")
;
1415 mat->getrowactive = PETSC_TRUE;
1416
1417 if (!mat->rowvalues && (idx || v)) {
1418 /*
1419 allocate enough space to hold information from the longest row.
1420 */
1421 Mat_SeqSBAIJ *Aa = (Mat_SeqSBAIJ*)mat->A->data;
1422 Mat_SeqBAIJ *Ba = (Mat_SeqBAIJ*)mat->B->data;
1423 PetscInt max = 1,mbs = mat->mbs,tmp;
1424 for (i=0; i<mbs; i++) {
1425 tmp = Aa->i[i+1] - Aa->i[i] + Ba->i[i+1] - Ba->i[i]; /* row length */
1426 if (max < tmp) max = tmp;
1427 }
1428 ierr = PetscMalloc2(max*bs2,&mat->rowvalues,max*bs2,&mat->rowindices)PetscMallocA(2,PETSC_FALSE,1428,__func__,"/sandbox/petsc/petsc.master/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),1428,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1429 }
1430
1431 if (row < brstart || row >= brend) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only local rows")return PetscError(((MPI_Comm)0x44000001),1431,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only local rows")
;
1432 lrow = row - brstart; /* local row index */
1433
1434 pvA = &vworkA; pcA = &cworkA; pvB = &vworkB; pcB = &cworkB;
1435 if (!v) {pvA = 0; pvB = 0;}
1436 if (!idx) {pcA = 0; if (!v) pcB = 0;}
1437 ierr = (*mat->A->ops->getrow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1437,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1438 ierr = (*mat->B->ops->getrow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1438,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1439 nztot = nzA + nzB;
1440
1441 cmap = mat->garray;
1442 if (v || idx) {
1443 if (nztot) {
1444 /* Sort by increasing column numbers, assuming A and B already sorted */
1445 PetscInt imark = -1;
1446 if (v) {
1447 *v = v_p = mat->rowvalues;
1448 for (i=0; i<nzB; i++) {
1449 if (cmap[cworkB[i]/bs] < cstart) v_p[i] = vworkB[i];
1450 else break;
1451 }
1452 imark = i;
1453 for (i=0; i<nzA; i++) v_p[imark+i] = vworkA[i];
1454 for (i=imark; i<nzB; i++) v_p[nzA+i] = vworkB[i];
1455 }
1456 if (idx) {
1457 *idx = idx_p = mat->rowindices;
1458 if (imark > -1) {
1459 for (i=0; i<imark; i++) {
1460 idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs;
1461 }
1462 } else {
1463 for (i=0; i<nzB; i++) {
1464 if (cmap[cworkB[i]/bs] < cstart) idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs;
1465 else break;
1466 }
1467 imark = i;
1468 }
1469 for (i=0; i<nzA; i++) idx_p[imark+i] = cstart*bs + cworkA[i];
1470 for (i=imark; i<nzB; i++) idx_p[nzA+i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs ;
1471 }
1472 } else {
1473 if (idx) *idx = 0;
1474 if (v) *v = 0;
1475 }
1476 }
1477 *nz = nztot;
1478 ierr = (*mat->A->ops->restorerow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1478,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1479 ierr = (*mat->B->ops->restorerow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1479,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1480 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1481}
1482
1483PetscErrorCode MatRestoreRow_MPISBAIJ(Mat mat,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1484{
1485 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1486
1487 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1487; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1488 if (!baij->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"MatGetRow() must be called first")return PetscError(((MPI_Comm)0x44000001),1488,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"MatGetRow() must be called first")
;
1489 baij->getrowactive = PETSC_FALSE;
1490 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1491}
1492
1493PetscErrorCode MatGetRowUpperTriangular_MPISBAIJ(Mat A)
1494{
1495 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1496 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1497
1498 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1498; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1499 aA->getrow_utriangular = PETSC_TRUE;
1500 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1501}
1502PetscErrorCode MatRestoreRowUpperTriangular_MPISBAIJ(Mat A)
1503{
1504 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1505 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1506
1507 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1507; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1508 aA->getrow_utriangular = PETSC_FALSE;
1509 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1510}
1511
1512PetscErrorCode MatRealPart_MPISBAIJ(Mat A)
1513{
1514 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1515 PetscErrorCode ierr;
1516
1517 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1517; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1518 ierr = MatRealPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1518,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1519 ierr = MatRealPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1519,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1520 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1521}
1522
1523PetscErrorCode MatImaginaryPart_MPISBAIJ(Mat A)
1524{
1525 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1526 PetscErrorCode ierr;
1527
1528 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1528; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1529 ierr = MatImaginaryPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1529,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1530 ierr = MatImaginaryPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1530,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1531 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1532}
1533
1534/* Check if isrow is a subset of iscol_local, called by MatCreateSubMatrix_MPISBAIJ()
1535 Input: isrow - distributed(parallel),
1536 iscol_local - locally owned (seq)
1537*/
1538PetscErrorCode ISEqual_private(IS isrow,IS iscol_local,PetscBool *flg)
1539{
1540 PetscErrorCode ierr;
1541 PetscInt sz1,sz2,*a1,*a2,i,j,k,nmatch;
1542 const PetscInt *ptr1,*ptr2;
1543
1544 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1544; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1545 ierr = ISGetLocalSize(isrow,&sz1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1545,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1546 ierr = ISGetLocalSize(iscol_local,&sz2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1546,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1547 if (sz1 > sz2) {
1548 *flg = PETSC_FALSE;
1549 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1550 }
1551
1552 ierr = ISGetIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1552,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1553 ierr = ISGetIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1553,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1554
1555 ierr = PetscMalloc1(sz1,&a1)PetscMallocA(1,PETSC_FALSE,1555,__func__,"/sandbox/petsc/petsc.master/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),1555,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1556 ierr = PetscMalloc1(sz2,&a2)PetscMallocA(1,PETSC_FALSE,1556,__func__,"/sandbox/petsc/petsc.master/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),1556,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1557 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),1557,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1558 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),1558,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1559 ierr = PetscSortInt(sz1,a1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1559,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1560 ierr = PetscSortInt(sz2,a2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1560,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1561
1562 nmatch=0;
1563 k = 0;
1564 for (i=0; i<sz1; i++){
1565 for (j=k; j<sz2; j++){
1566 if (a1[i] == a2[j]) {
1567 k = j; nmatch++;
1568 break;
1569 }
1570 }
1571 }
1572 ierr = ISRestoreIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1572,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1573 ierr = ISRestoreIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1573,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1574 ierr = PetscFree(a1)((*PetscTrFree)((void*)(a1),1574,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((a1) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1574,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1575 ierr = PetscFree(a2)((*PetscTrFree)((void*)(a2),1575,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((a2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1575,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1576 if (nmatch < sz1) {
1577 *flg = PETSC_FALSE;
1578 } else {
1579 *flg = PETSC_TRUE;
1580 }
1581 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1582}
1583
1584PetscErrorCode MatCreateSubMatrix_MPISBAIJ(Mat mat,IS isrow,IS iscol,MatReuse call,Mat *newmat)
1585{
1586 PetscErrorCode ierr;
1587 IS iscol_local;
1588 PetscInt csize;
1589 PetscBool isequal;
1590
1591 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1591; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1592 ierr = ISGetLocalSize(iscol,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1592,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1593 if (call == MAT_REUSE_MATRIX) {
1594 ierr = PetscObjectQuery((PetscObject)*newmat,"ISAllGather",(PetscObject*)&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1594,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1595 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),1595,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Submatrix passed in was not used before, cannot reuse"
)
;
1596 } else {
1597 ierr = ISAllGather(iscol,&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1597,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1598 ierr = ISEqual_private(isrow,iscol_local,&isequal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1598,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1599 if (!isequal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"For symmetric format, iscol must equal isrow")return PetscError(((MPI_Comm)0x44000001),1599,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,75,PETSC_ERROR_INITIAL,"For symmetric format, iscol must equal isrow"
)
;
1600 }
1601
1602 /* now call MatCreateSubMatrix_MPIBAIJ() */
1603 ierr = MatCreateSubMatrix_MPIBAIJ_Private(mat,isrow,iscol_local,csize,call,newmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1603,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1604 if (call == MAT_INITIAL_MATRIX) {
1605 ierr = PetscObjectCompose((PetscObject)*newmat,"ISAllGather",(PetscObject)iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1605,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1606 ierr = ISDestroy(&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1606,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1607 }
1608 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1609}
1610
1611PetscErrorCode MatZeroEntries_MPISBAIJ(Mat A)
1612{
1613 Mat_MPISBAIJ *l = (Mat_MPISBAIJ*)A->data;
1614 PetscErrorCode ierr;
1615
1616 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1616; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1617 ierr = MatZeroEntries(l->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1617,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1618 ierr = MatZeroEntries(l->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1618,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1619 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1620}
1621
1622PetscErrorCode MatGetInfo_MPISBAIJ(Mat matin,MatInfoType flag,MatInfo *info)
1623{
1624 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)matin->data;
1625 Mat A = a->A,B = a->B;
1626 PetscErrorCode ierr;
1627 PetscReal isend[5],irecv[5];
1628
1629 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1629; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1630 info->block_size = (PetscReal)matin->rmap->bs;
1631
1632 ierr = MatGetInfo(A,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1632,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1633
1634 isend[0] = info->nz_used; isend[1] = info->nz_allocated; isend[2] = info->nz_unneeded;
1635 isend[3] = info->memory; isend[4] = info->mallocs;
1636
1637 ierr = MatGetInfo(B,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1637,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1638
1639 isend[0] += info->nz_used; isend[1] += info->nz_allocated; isend[2] += info->nz_unneeded;
1640 isend[3] += info->memory; isend[4] += info->mallocs;
1641 if (flag == MAT_LOCAL) {
1642 info->nz_used = isend[0];
1643 info->nz_allocated = isend[1];
1644 info->nz_unneeded = isend[2];
1645 info->memory = isend[3];
1646 info->mallocs = isend[4];
1647 } else if (flag == MAT_GLOBAL_MAX) {
1648 ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin
),5,1648,__func__,"/sandbox/petsc/petsc.master/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),1648,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1649
1650 info->nz_used = irecv[0];
1651 info->nz_allocated = irecv[1];
1652 info->nz_unneeded = irecv[2];
1653 info->memory = irecv[3];
1654 info->mallocs = irecv[4];
1655 } else if (flag == MAT_GLOBAL_SUM) {
1656 ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin
),5,1656,__func__,"/sandbox/petsc/petsc.master/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),1656,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1657
1658 info->nz_used = irecv[0];
1659 info->nz_allocated = irecv[1];
1660 info->nz_unneeded = irecv[2];
1661 info->memory = irecv[3];
1662 info->mallocs = irecv[4];
1663 } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown MatInfoType argument %d",(int)flag)return PetscError(((MPI_Comm)0x44000001),1663,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Unknown MatInfoType argument %d",(int
)flag)
;
1664 info->fill_ratio_given = 0; /* no parallel LU/ILU/Cholesky */
1665 info->fill_ratio_needed = 0;
1666 info->factor_mallocs = 0;
1667 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1668}
1669
1670PetscErrorCode MatSetOption_MPISBAIJ(Mat A,MatOption op,PetscBool flg)
1671{
1672 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1673 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1674 PetscErrorCode ierr;
1675
1676 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1676; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1677 switch (op) {
1678 case MAT_NEW_NONZERO_LOCATIONS:
1679 case MAT_NEW_NONZERO_ALLOCATION_ERR:
1680 case MAT_UNUSED_NONZERO_LOCATION_ERR:
1681 case MAT_KEEP_NONZERO_PATTERN:
1682 case MAT_SUBMAT_SINGLEIS:
1683 case MAT_NEW_NONZERO_LOCATION_ERR:
1684 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1684,__func__,"/sandbox/petsc/petsc.master/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)
;
1685 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1685,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1686 ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1686,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1687 break;
1688 case MAT_ROW_ORIENTED:
1689 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1689,__func__,"/sandbox/petsc/petsc.master/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)
;
1690 a->roworiented = flg;
1691
1692 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1692,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1693 ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1693,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1694 break;
1695 case MAT_NEW_DIAGONALS:
1696 case MAT_SORTED_FULL:
1697 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),1697,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1698 break;
1699 case MAT_IGNORE_OFF_PROC_ENTRIES:
1700 a->donotstash = flg;
1701 break;
1702 case MAT_USE_HASH_TABLE:
1703 a->ht_flag = flg;
1704 break;
1705 case MAT_HERMITIAN:
1706 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1706,__func__,"/sandbox/petsc/petsc.master/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)
;
1707 if (!A->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must call MatAssemblyEnd() first")return PetscError(((MPI_Comm)0x44000001),1707,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatAssemblyEnd() first")
;
1708 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1708,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1709#if defined(PETSC_USE_COMPLEX)
1710 A->ops->mult = MatMult_MPISBAIJ_Hermitian;
1711#endif
1712 break;
1713 case MAT_SPD:
1714 A->spd_set = PETSC_TRUE;
1715 A->spd = flg;
1716 if (flg) {
1717 A->symmetric = PETSC_TRUE;
1718 A->structurally_symmetric = PETSC_TRUE;
1719 A->symmetric_set = PETSC_TRUE;
1720 A->structurally_symmetric_set = PETSC_TRUE;
1721 }
1722 break;
1723 case MAT_SYMMETRIC:
1724 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1724,__func__,"/sandbox/petsc/petsc.master/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)
;
1725 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1725,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1726 break;
1727 case MAT_STRUCTURALLY_SYMMETRIC:
1728 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1728,__func__,"/sandbox/petsc/petsc.master/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)
;
1729 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1729,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1730 break;
1731 case MAT_SYMMETRY_ETERNAL:
1732 if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Matrix must be symmetric")return PetscError(((MPI_Comm)0x44000001),1732,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Matrix must be symmetric")
;
1733 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),1733,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1734 break;
1735 case MAT_IGNORE_LOWER_TRIANGULAR:
1736 aA->ignore_ltriangular = flg;
1737 break;
1738 case MAT_ERROR_LOWER_TRIANGULAR:
1739 aA->ignore_ltriangular = flg;
1740 break;
1741 case MAT_GETROW_UPPERTRIANGULAR:
1742 aA->getrow_utriangular = flg;
1743 break;
1744 default:
1745 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1745,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"unknown option %d",op)
;
1746 }
1747 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1748}
1749
1750PetscErrorCode MatTranspose_MPISBAIJ(Mat A,MatReuse reuse,Mat *B)
1751{
1752 PetscErrorCode ierr;
1753
1754 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1754; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1755 if (reuse == MAT_INITIAL_MATRIX) {
1756 ierr = MatDuplicate(A,MAT_COPY_VALUES,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1756,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1757 } else if (reuse == MAT_REUSE_MATRIX) {
1758 ierr = MatCopy(A,*B,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1758,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1759 }
1760 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1761}
1762
1763PetscErrorCode MatDiagonalScale_MPISBAIJ(Mat mat,Vec ll,Vec rr)
1764{
1765 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1766 Mat a = baij->A, b=baij->B;
1767 PetscErrorCode ierr;
1768 PetscInt nv,m,n;
1769 PetscBool flg;
1770
1771 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1771; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1772 if (ll != rr) {
1773 ierr = VecEqual(ll,rr,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1773,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1774 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),1774,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"For symmetric format, left and right scaling vectors must be same\n"
)
;
1775 }
1776 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)
;
1777
1778 ierr = MatGetLocalSize(mat,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1778,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1779 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),1779,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"For symmetric format, local size %d %d must be same"
,m,n)
;
1780
1781 ierr = VecGetLocalSize(rr,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1781,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1782 if (nv!=n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left and right vector non-conforming local size")return PetscError(((MPI_Comm)0x44000001),1782,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Left and right vector non-conforming local size"
)
;
1783
1784 ierr = VecScatterBegin(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1784,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1785
1786 /* left diagonalscale the off-diagonal part */
1787 ierr = (*b->ops->diagonalscale)(b,ll,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1787,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1788
1789 /* scale the diagonal part */
1790 ierr = (*a->ops->diagonalscale)(a,ll,rr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1790,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1791
1792 /* right diagonalscale the off-diagonal part */
1793 ierr = VecScatterEnd(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1793,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1794 ierr = (*b->ops->diagonalscale)(b,NULL((void*)0),baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1794,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1795 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1796}
1797
1798PetscErrorCode MatSetUnfactored_MPISBAIJ(Mat A)
1799{
1800 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1801 PetscErrorCode ierr;
1802
1803 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1803; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1804 ierr = MatSetUnfactored(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1804,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1805 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1806}
1807
1808static PetscErrorCode MatDuplicate_MPISBAIJ(Mat,MatDuplicateOption,Mat*);
1809
1810PetscErrorCode MatEqual_MPISBAIJ(Mat A,Mat B,PetscBool *flag)
1811{
1812 Mat_MPISBAIJ *matB = (Mat_MPISBAIJ*)B->data,*matA = (Mat_MPISBAIJ*)A->data;
1813 Mat a,b,c,d;
1814 PetscBool flg;
1815 PetscErrorCode ierr;
1816
1817 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1817; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1818 a = matA->A; b = matA->B;
1819 c = matB->A; d = matB->B;
1820
1821 ierr = MatEqual(a,c,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1821,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1822 if (flg) {
1823 ierr = MatEqual(b,d,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1823,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1824 }
1825 ierr = MPIU_Allreduce(&flg,flag,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)A))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)A),1
,1825,__func__,"/sandbox/petsc/petsc.master/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),1825,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1826 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1827}
1828
1829PetscErrorCode MatCopy_MPISBAIJ(Mat A,Mat B,MatStructure str)
1830{
1831 PetscErrorCode ierr;
1832 PetscBool isbaij;
1833
1834 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1834; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1835 ierr = PetscObjectTypeCompareAny((PetscObject)B,&isbaij,MATSEQSBAIJ"seqsbaij",MATMPISBAIJ"mpisbaij","");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1835,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1836 if (!isbaij) SETERRQ1(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"Not for matrix type %s",((PetscObject)B)->type_name)return PetscError(PetscObjectComm((PetscObject)B),1836,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Not for matrix type %s",((PetscObject
)B)->type_name)
;
1837 /* If the two matrices don't have the same copy implementation, they aren't compatible for fast copy. */
1838 if ((str != SAME_NONZERO_PATTERN) || (A->ops->copy != B->ops->copy)) {
1839 ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1839,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1840 ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1840,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1841 ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1841,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1842 } else {
1843 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1844 Mat_MPISBAIJ *b = (Mat_MPISBAIJ*)B->data;
1845
1846 ierr = MatCopy(a->A,b->A,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1846,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1847 ierr = MatCopy(a->B,b->B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1847,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1848 }
1849 ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1849,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1850 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1851}
1852
1853PetscErrorCode MatSetUp_MPISBAIJ(Mat A)
1854{
1855 PetscErrorCode ierr;
1856
1857 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1857; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1858 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),1858,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1859 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1860}
1861
1862PetscErrorCode MatAXPY_MPISBAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str)
1863{
1864 PetscErrorCode ierr;
1865 Mat_MPISBAIJ *xx=(Mat_MPISBAIJ*)X->data,*yy=(Mat_MPISBAIJ*)Y->data;
1866 PetscBLASInt bnz,one=1;
1867 Mat_SeqSBAIJ *xa,*ya;
1868 Mat_SeqBAIJ *xb,*yb;
1869
1870 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1870; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1871 if (str == SAME_NONZERO_PATTERN) {
1872 PetscScalar alpha = a;
1873 xa = (Mat_SeqSBAIJ*)xx->A->data;
1874 ya = (Mat_SeqSBAIJ*)yy->A->data;
1875 ierr = PetscBLASIntCast(xa->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1875,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1876 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.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1876; 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(1876
,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1876,__func__,"/sandbox/petsc/petsc.master/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)
;
1877 xb = (Mat_SeqBAIJ*)xx->B->data;
1878 yb = (Mat_SeqBAIJ*)yy->B->data;
1879 ierr = PetscBLASIntCast(xb->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1879,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1880 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.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1880; 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(1880
,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1880,__func__,"/sandbox/petsc/petsc.master/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)
;
1881 ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1881,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1882 } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */
1883 ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1883,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1884 ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1884,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1885 ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1885,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1886 } else {
1887 Mat B;
1888 PetscInt *nnz_d,*nnz_o,bs=Y->rmap->bs;
1889 if (bs != X->rmap->bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Matrices must have same block size")return PetscError(((MPI_Comm)0x44000001),1889,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Matrices must have same block size")
;
1890 ierr = MatGetRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1890,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1891 ierr = MatGetRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1891,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1892 ierr = PetscMalloc1(yy->A->rmap->N,&nnz_d)PetscMallocA(1,PETSC_FALSE,1892,__func__,"/sandbox/petsc/petsc.master/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),1892,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1893 ierr = PetscMalloc1(yy->B->rmap->N,&nnz_o)PetscMallocA(1,PETSC_FALSE,1893,__func__,"/sandbox/petsc/petsc.master/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),1893,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1894 ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1894,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1895 ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1895,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1896 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),1896,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1897 ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1897,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1898 ierr = MatSetType(B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1898,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1899 ierr = MatAXPYGetPreallocation_SeqSBAIJ(yy->A,xx->A,nnz_d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1899,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1900 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),1900,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1901 ierr = MatMPISBAIJSetPreallocation(B,bs,0,nnz_d,0,nnz_o);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1901,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1902 ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1902,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1903 ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1903,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1904 ierr = PetscFree(nnz_d)((*PetscTrFree)((void*)(nnz_d),1904,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((nnz_d) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1904,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1905 ierr = PetscFree(nnz_o)((*PetscTrFree)((void*)(nnz_o),1905,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((nnz_o) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1905,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1906 ierr = MatRestoreRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1906,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1907 ierr = MatRestoreRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1907,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1908 }
1909 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1910}
1911
1912PetscErrorCode MatCreateSubMatrices_MPISBAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[])
1913{
1914 PetscErrorCode ierr;
1915 PetscInt i;
1916 PetscBool flg;
1917
1918 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1918; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1919 ierr = MatCreateSubMatrices_MPIBAIJ(A,n,irow,icol,scall,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1919,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* B[] are sbaij matrices */
1920 for (i=0; i<n; i++) {
1921 ierr = ISEqual(irow[i],icol[i],&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1921,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1922 if (!flg) {
1923 ierr = MatSeqSBAIJZeroOps_Private(*B[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1923,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1924 }
1925 }
1926 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1927}
1928
1929PetscErrorCode MatShift_MPISBAIJ(Mat Y,PetscScalar a)
1930{
1931 PetscErrorCode ierr;
1932 Mat_MPISBAIJ *maij = (Mat_MPISBAIJ*)Y->data;
1933 Mat_SeqSBAIJ *aij = (Mat_SeqSBAIJ*)maij->A->data;
1934
1935 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1935; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1936 if (!Y->preallocated) {
1937 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),1937,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1938 } else if (!aij->nz) {
1939 PetscInt nonew = aij->nonew;
1940 ierr = MatSeqSBAIJSetPreallocation(maij->A,Y->rmap->bs,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1940,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1941 aij->nonew = nonew;
1942 }
1943 ierr = MatShift_Basic(Y,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1943,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1944 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1945}
1946
1947PetscErrorCode MatMissingDiagonal_MPISBAIJ(Mat A,PetscBool *missing,PetscInt *d)
1948{
1949 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1950 PetscErrorCode ierr;
1951
1952 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1952; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1953 if (A->rmap->n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only works for square matrices")return PetscError(((MPI_Comm)0x44000001),1953,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only works for square matrices")
;
1954 ierr = MatMissingDiagonal(a->A,missing,d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1954,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1955 if (d) {
1956 PetscInt rstart;
1957 ierr = MatGetOwnershipRange(A,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1957,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1958 *d += rstart/A->rmap->bs;
1959
1960 }
1961 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1962}
1963
1964PetscErrorCode MatGetDiagonalBlock_MPISBAIJ(Mat A,Mat *a)
1965{
1966 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1966; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1967 *a = ((Mat_MPISBAIJ*)A->data)->A;
1968 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1969}
1970
1971/* -------------------------------------------------------------------*/
1972static struct _MatOps MatOps_Values = {MatSetValues_MPISBAIJ,
1973 MatGetRow_MPISBAIJ,
1974 MatRestoreRow_MPISBAIJ,
1975 MatMult_MPISBAIJ,
1976 /* 4*/ MatMultAdd_MPISBAIJ,
1977 MatMult_MPISBAIJ, /* transpose versions are same as non-transpose */
1978 MatMultAdd_MPISBAIJ,
1979 0,
1980 0,
1981 0,
1982 /* 10*/ 0,
1983 0,
1984 0,
1985 MatSOR_MPISBAIJ,
1986 MatTranspose_MPISBAIJ,
1987 /* 15*/ MatGetInfo_MPISBAIJ,
1988 MatEqual_MPISBAIJ,
1989 MatGetDiagonal_MPISBAIJ,
1990 MatDiagonalScale_MPISBAIJ,
1991 MatNorm_MPISBAIJ,
1992 /* 20*/ MatAssemblyBegin_MPISBAIJ,
1993 MatAssemblyEnd_MPISBAIJ,
1994 MatSetOption_MPISBAIJ,
1995 MatZeroEntries_MPISBAIJ,
1996 /* 24*/ 0,
1997 0,
1998 0,
1999 0,
2000 0,
2001 /* 29*/ MatSetUp_MPISBAIJ,
2002 0,
2003 0,
2004 MatGetDiagonalBlock_MPISBAIJ,
2005 0,
2006 /* 34*/ MatDuplicate_MPISBAIJ,
2007 0,
2008 0,
2009 0,
2010 0,
2011 /* 39*/ MatAXPY_MPISBAIJ,
2012 MatCreateSubMatrices_MPISBAIJ,
2013 MatIncreaseOverlap_MPISBAIJ,
2014 MatGetValues_MPISBAIJ,
2015 MatCopy_MPISBAIJ,
2016 /* 44*/ 0,
2017 MatScale_MPISBAIJ,
2018 MatShift_MPISBAIJ,
2019 0,
2020 0,
2021 /* 49*/ 0,
2022 0,
2023 0,
2024 0,
2025 0,
2026 /* 54*/ 0,
2027 0,
2028 MatSetUnfactored_MPISBAIJ,
2029 0,
2030 MatSetValuesBlocked_MPISBAIJ,
2031 /* 59*/ MatCreateSubMatrix_MPISBAIJ,
2032 0,
2033 0,
2034 0,
2035 0,
2036 /* 64*/ 0,
2037 0,
2038 0,
2039 0,
2040 0,
2041 /* 69*/ MatGetRowMaxAbs_MPISBAIJ,
2042 0,
2043 0,
2044 0,
2045 0,
2046 /* 74*/ 0,
2047 0,
2048 0,
2049 0,
2050 0,
2051 /* 79*/ 0,
2052 0,
2053 0,
2054 0,
2055 MatLoad_MPISBAIJ,
2056 /* 84*/ 0,
2057 0,
2058 0,
2059 0,
2060 0,
2061 /* 89*/ 0,
2062 0,
2063 0,
2064 0,
2065 0,
2066 /* 94*/ 0,
2067 0,
2068 0,
2069 0,
2070 0,
2071 /* 99*/ 0,
2072 0,
2073 0,
2074 0,
2075 0,
2076 /*104*/ 0,
2077 MatRealPart_MPISBAIJ,
2078 MatImaginaryPart_MPISBAIJ,
2079 MatGetRowUpperTriangular_MPISBAIJ,
2080 MatRestoreRowUpperTriangular_MPISBAIJ,
2081 /*109*/ 0,
2082 0,
2083 0,
2084 0,
2085 MatMissingDiagonal_MPISBAIJ,
2086 /*114*/ 0,
2087 0,
2088 0,
2089 0,
2090 0,
2091 /*119*/ 0,
2092 0,
2093 0,
2094 0,
2095 0,
2096 /*124*/ 0,
2097 0,
2098 0,
2099 0,
2100 0,
2101 /*129*/ 0,
2102 0,
2103 0,
2104 0,
2105 0,
2106 /*134*/ 0,
2107 0,
2108 0,
2109 0,
2110 0,
2111 /*139*/ MatSetBlockSizes_Default,
2112 0,
2113 0,
2114 0,
2115 0,
2116 /*144*/MatCreateMPIMatConcatenateSeqMat_MPISBAIJ
2117};
2118
2119PetscErrorCode MatMPISBAIJSetPreallocation_MPISBAIJ(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt *d_nnz,PetscInt o_nz,const PetscInt *o_nnz)
2120{
2121 Mat_MPISBAIJ *b = (Mat_MPISBAIJ*)B->data;
2122 PetscErrorCode ierr;
2123 PetscInt i,mbs,Mbs;
2124 PetscMPIInt size;
2125
2126 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2126; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2127 ierr = MatSetBlockSize(B,PetscAbs(bs)(((bs) >= 0) ? (bs) : (-(bs))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2127,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2128 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2128,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2129 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2129,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2130 ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2130,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2131 if (B->rmap->N > B->cmap->N) SETERRQ2(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"MPISBAIJ matrix cannot have more rows %D than columns %D",B->rmap->N,B->cmap->N)return PetscError(PetscObjectComm((PetscObject)B),2131,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MPISBAIJ matrix cannot have more rows %D than columns %D"
,B->rmap->N,B->cmap->N)
;
2132 if (B->rmap->n > B->cmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"MPISBAIJ matrix cannot have more local rows %D than columns %D",B->rmap->n,B->cmap->n)return PetscError(((MPI_Comm)0x44000001),2132,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MPISBAIJ matrix cannot have more local rows %D than columns %D"
,B->rmap->n,B->cmap->n)
;
2133
2134 mbs = B->rmap->n/bs;
2135 Mbs = B->rmap->N/bs;
2136 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),2136,__func__,"/sandbox/petsc/petsc.master/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)
;
2137
2138 B->rmap->bs = bs;
2139 b->bs2 = bs*bs;
2140 b->mbs = mbs;
2141 b->Mbs = Mbs;
2142 b->nbs = B->cmap->n/bs;
2143 b->Nbs = B->cmap->N/bs;
2144
2145 for (i=0; i<=b->size; i++) {
2146 b->rangebs[i] = B->rmap->range[i]/bs;
2147 }
2148 b->rstartbs = B->rmap->rstart/bs;
2149 b->rendbs = B->rmap->rend/bs;
2150
2151 b->cstartbs = B->cmap->rstart/bs;
2152 b->cendbs = B->cmap->rend/bs;
2153
2154#if defined(PETSC_USE_CTABLE1)
2155 ierr = PetscTableDestroy(&b->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2155,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2156#else
2157 ierr = PetscFree(b->colmap)((*PetscTrFree)((void*)(b->colmap),2157,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((b->colmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2157,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2158#endif
2159 ierr = PetscFree(b->garray)((*PetscTrFree)((void*)(b->garray),2159,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((b->garray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2159,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2160 ierr = VecDestroy(&b->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2160,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2161 ierr = VecScatterDestroy(&b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2161,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2162 ierr = VecDestroy(&b->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2162,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2163 ierr = VecDestroy(&b->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2163,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2164 ierr = VecDestroy(&b->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2164,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2165 ierr = VecDestroy(&b->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2165,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2166 ierr = VecDestroy(&b->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2166,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2167 ierr = VecScatterDestroy(&b->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2167,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2168
2169 /* Because the B will have been resized we simply destroy it and create a new one each time */
2170 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2170,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2171 ierr = MatDestroy(&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2171,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2172 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2172,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2173 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),2173,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2174 ierr = MatSetType(b->B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2174,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2175 ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2175,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2176
2177 if (!B->preallocated) {
2178 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2178,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2179 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),2179,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2180 ierr = MatSetType(b->A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2180,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2181 ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2181,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2182 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),bs,&B->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2182,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2183 }
2184
2185 ierr = MatSeqSBAIJSetPreallocation(b->A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2185,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2186 ierr = MatSeqBAIJSetPreallocation(b->B,bs,o_nz,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2186,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2187
2188 B->preallocated = PETSC_TRUE;
2189 B->was_assembled = PETSC_FALSE;
2190 B->assembled = PETSC_FALSE;
2191 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2192}
2193
2194PetscErrorCode MatMPISBAIJSetPreallocationCSR_MPISBAIJ(Mat B,PetscInt bs,const PetscInt ii[],const PetscInt jj[],const PetscScalar V[])
2195{
2196 PetscInt m,rstart,cend;
2197 PetscInt i,j,d,nz,bd, nz_max=0,*d_nnz=0,*o_nnz=0;
2198 const PetscInt *JJ =0;
2199 PetscScalar *values=0;
2200 PetscBool roworiented = ((Mat_MPISBAIJ*)B->data)->roworiented;
2201 PetscErrorCode ierr;
2202
2203 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2203; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2204 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),2204,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Invalid block size specified, must be positive but it is %D"
,bs)
;
2205 ierr = PetscLayoutSetBlockSize(B->rmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2205,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2206 ierr = PetscLayoutSetBlockSize(B->cmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2206,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2207 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2207,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2208 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2208,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2209 ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2209,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2210 m = B->rmap->n/bs;
2211 rstart = B->rmap->rstart/bs;
2212 cend = B->cmap->rend/bs;
2213
2214 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),2214,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"ii[0] must be 0 but it is %D",ii[0])
;
2215 ierr = PetscMalloc2(m,&d_nnz,m,&o_nnz)PetscMallocA(2,PETSC_FALSE,2215,__func__,"/sandbox/petsc/petsc.master/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),2215,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2216 for (i=0; i<m; i++) {
2217 nz = ii[i+1] - ii[i];
2218 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),2218,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Local row %D has a negative number of columns %D"
,i,nz)
;
2219 /* count the ones on the diagonal and above, split into diagonal and off diagonal portions. */
2220 JJ = jj + ii[i];
2221 bd = 0;
2222 for (j=0; j<nz; j++) {
2223 if (*JJ >= i + rstart) break;
2224 JJ++;
2225 bd++;
2226 }
2227 d = 0;
2228 for (; j<nz; j++) {
2229 if (*JJ++ >= cend) break;
2230 d++;
2231 }
2232 d_nnz[i] = d;
2233 o_nnz[i] = nz - d - bd;
2234 nz = nz - bd;
2235 nz_max = PetscMax(nz_max,nz)(((nz_max)<(nz)) ? (nz) : (nz_max));
2236 }
2237 ierr = MatMPISBAIJSetPreallocation(B,bs,0,d_nnz,0,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2237,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2238 ierr = MatSetOption(B,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2238,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2239 ierr = PetscFree2(d_nnz,o_nnz)PetscFreeA(2,2239,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(d_nnz),&(o_nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2239,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2240
2241 values = (PetscScalar*)V;
2242 if (!values) {
2243 ierr = PetscCalloc1(bs*bs*nz_max,&values)PetscMallocA(1,PETSC_TRUE,2243,__func__,"/sandbox/petsc/petsc.master/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),2243,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2244 }
2245 for (i=0; i<m; i++) {
2246 PetscInt row = i + rstart;
2247 PetscInt ncols = ii[i+1] - ii[i];
2248 const PetscInt *icols = jj + ii[i];
2249 if (bs == 1 || !roworiented) { /* block ordering matches the non-nested layout of MatSetValues so we can insert entire rows */
2250 const PetscScalar *svals = values + (V ? (bs*bs*ii[i]) : 0);
2251 ierr = MatSetValuesBlocked_MPISBAIJ(B,1,&row,ncols,icols,svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2251,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2252 } else { /* block ordering does not match so we can only insert one block at a time. */
2253 PetscInt j;
2254 for (j=0; j<ncols; j++) {
2255 const PetscScalar *svals = values + (V ? (bs*bs*(ii[i]+j)) : 0);
2256 ierr = MatSetValuesBlocked_MPISBAIJ(B,1,&row,1,&icols[j],svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2256,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2257 }
2258 }
2259 }
2260
2261 if (!V) { ierr = PetscFree(values)((*PetscTrFree)((void*)(values),2261,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2261,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
2262 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2262,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2263 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2263,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2264 ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2264,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2265 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2266}
2267
2268/*MC
2269 MATMPISBAIJ - MATMPISBAIJ = "mpisbaij" - A matrix type to be used for distributed symmetric sparse block matrices,
2270 based on block compressed sparse row format. Only the upper triangular portion of the "diagonal" portion of
2271 the matrix is stored.
2272
2273 For complex numbers by default this matrix is symmetric, NOT Hermitian symmetric. To make it Hermitian symmetric you
2274 can call MatSetOption(Mat, MAT_HERMITIAN);
2275
2276 Options Database Keys:
2277. -mat_type mpisbaij - sets the matrix type to "mpisbaij" during a call to MatSetFromOptions()
2278
2279 Notes:
2280 The number of rows in the matrix must be less than or equal to the number of columns. Similarly the number of rows in the
2281 diagonal portion of the matrix of each process has to less than or equal the number of columns.
2282
2283 Level: beginner
2284
2285.seealso: MatCreateMPISBAIJ(), MATSEQSBAIJ, MatType
2286M*/
2287
2288PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_MPISBAIJ(Mat B)
2289{
2290 Mat_MPISBAIJ *b;
2291 PetscErrorCode ierr;
2292 PetscBool flg = PETSC_FALSE;
2293
2294 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2294; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2295 ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,2295,__func__,"/sandbox/petsc/petsc.master/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),2295,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2296 B->data = (void*)b;
2297 ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2297,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2298
2299 B->ops->destroy = MatDestroy_MPISBAIJ;
2300 B->ops->view = MatView_MPISBAIJ;
2301 B->assembled = PETSC_FALSE;
2302 B->insertmode = NOT_SET_VALUES;
2303
2304 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)B),&b->rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2304,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2305 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&b->size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2305,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2306
2307 /* build local table of row and column ownerships */
2308 ierr = PetscMalloc1(b->size+2,&b->rangebs)PetscMallocA(1,PETSC_FALSE,2308,__func__,"/sandbox/petsc/petsc.master/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),2308,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2309
2310 /* build cache for off array entries formed */
2311 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),1,&B->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2311,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2312
2313 b->donotstash = PETSC_FALSE;
2314 b->colmap = NULL((void*)0);
2315 b->garray = NULL((void*)0);
2316 b->roworiented = PETSC_TRUE;
2317
2318 /* stuff used in block assembly */
2319 b->barray = 0;
2320
2321 /* stuff used for matrix vector multiply */
2322 b->lvec = 0;
2323 b->Mvctx = 0;
2324 b->slvec0 = 0;
2325 b->slvec0b = 0;
2326 b->slvec1 = 0;
2327 b->slvec1a = 0;
2328 b->slvec1b = 0;
2329 b->sMvctx = 0;
2330
2331 /* stuff for MatGetRow() */
2332 b->rowindices = 0;
2333 b->rowvalues = 0;
2334 b->getrowactive = PETSC_FALSE;
2335
2336 /* hash table stuff */
2337 b->ht = 0;
2338 b->hd = 0;
2339 b->ht_size = 0;
2340 b->ht_flag = PETSC_FALSE;
2341 b->ht_fact = 0;
2342 b->ht_total_ct = 0;
2343 b->ht_insert_ct = 0;
2344
2345 /* stuff for MatCreateSubMatrices_MPIBAIJ_local() */
2346 b->ijonly = PETSC_FALSE;
2347
2348 b->in_loc = 0;
2349 b->v_loc = 0;
2350 b->n_loc = 0;
2351
2352 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),2352,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2353 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),2353,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2354 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),2354,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2355 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),2355,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2356#if defined(PETSC_HAVE_ELEMENTAL)
2357 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),2357,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2358#endif
2359 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),2359,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2360 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),2360,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2361
2362 B->symmetric = PETSC_TRUE;
2363 B->structurally_symmetric = PETSC_TRUE;
2364 B->symmetric_set = PETSC_TRUE;
2365 B->structurally_symmetric_set = PETSC_TRUE;
2366 B->symmetric_eternal = PETSC_TRUE;
2367
2368 B->hermitian = PETSC_FALSE;
2369 B->hermitian_set = PETSC_FALSE;
2370
2371 ierr = PetscObjectChangeTypeName((PetscObject)B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2371,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2372 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),2372,__func__,"/sandbox/petsc/petsc.master/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),2372,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2373 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),2373,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2374 if (flg) {
2375 PetscReal fact = 1.39;
2376 ierr = MatSetOption(B,MAT_USE_HASH_TABLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2376,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2377 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),2377,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2378 if (fact <= 1.0) fact = 1.39;
2379 ierr = MatMPIBAIJSetHashTableFactor(B,fact);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2379,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2380 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),2380,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2381 }
2382 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2382,__func__,"/sandbox/petsc/petsc.master/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),2382,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2383 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2384}
2385
2386/*MC
2387 MATSBAIJ - MATSBAIJ = "sbaij" - A matrix type to be used for symmetric block sparse matrices.
2388
2389 This matrix type is identical to MATSEQSBAIJ when constructed with a single process communicator,
2390 and MATMPISBAIJ otherwise.
2391
2392 Options Database Keys:
2393. -mat_type sbaij - sets the matrix type to "sbaij" during a call to MatSetFromOptions()
2394
2395 Level: beginner
2396
2397.seealso: MatCreateMPISBAIJ,MATSEQSBAIJ,MATMPISBAIJ
2398M*/
2399
2400/*@C
2401 MatMPISBAIJSetPreallocation - For good matrix assembly performance
2402 the user should preallocate the matrix storage by setting the parameters
2403 d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately,
2404 performance can be increased by more than a factor of 50.
2405
2406 Collective on Mat
2407
2408 Input Parameters:
2409+ B - the matrix
2410. bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row
2411 blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()
2412. d_nz - number of block nonzeros per block row in diagonal portion of local
2413 submatrix (same for all local rows)
2414. d_nnz - array containing the number of block nonzeros in the various block rows
2415 in the upper triangular and diagonal part of the in diagonal portion of the local
2416 (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room
2417 for the diagonal entry and set a value even if it is zero.
2418. o_nz - number of block nonzeros per block row in the off-diagonal portion of local
2419 submatrix (same for all local rows).
2420- o_nnz - array containing the number of nonzeros in the various block rows of the
2421 off-diagonal portion of the local submatrix that is right of the diagonal
2422 (possibly different for each block row) or NULL.
2423
2424
2425 Options Database Keys:
2426+ -mat_no_unroll - uses code that does not unroll the loops in the
2427 block calculations (much slower)
2428- -mat_block_size - size of the blocks to use
2429
2430 Notes:
2431
2432 If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor
2433 than it must be used on all processors that share the object for that argument.
2434
2435 If the *_nnz parameter is given then the *_nz parameter is ignored
2436
2437 Storage Information:
2438 For a square global matrix we define each processor's diagonal portion
2439 to be its local rows and the corresponding columns (a square submatrix);
2440 each processor's off-diagonal portion encompasses the remainder of the
2441 local matrix (a rectangular submatrix).
2442
2443 The user can specify preallocated storage for the diagonal part of
2444 the local submatrix with either d_nz or d_nnz (not both). Set
2445 d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic
2446 memory allocation. Likewise, specify preallocated storage for the
2447 off-diagonal part of the local submatrix with o_nz or o_nnz (not both).
2448
2449 You can call MatGetInfo() to get information on how effective the preallocation was;
2450 for example the fields mallocs,nz_allocated,nz_used,nz_unneeded;
2451 You can also run with the option -info and look for messages with the string
2452 malloc in them to see if additional memory allocation was needed.
2453
2454 Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In
2455 the figure below we depict these three local rows and all columns (0-11).
2456
2457.vb
2458 0 1 2 3 4 5 6 7 8 9 10 11
2459 --------------------------
2460 row 3 |. . . d d d o o o o o o
2461 row 4 |. . . d d d o o o o o o
2462 row 5 |. . . d d d o o o o o o
2463 --------------------------
2464.ve
2465
2466 Thus, any entries in the d locations are stored in the d (diagonal)
2467 submatrix, and any entries in the o locations are stored in the
2468 o (off-diagonal) submatrix. Note that the d matrix is stored in
2469 MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format.
2470
2471 Now d_nz should indicate the number of block nonzeros per row in the upper triangular
2472 plus the diagonal part of the d matrix,
2473 and o_nz should indicate the number of block nonzeros per row in the o matrix
2474
2475 In general, for PDE problems in which most nonzeros are near the diagonal,
2476 one expects d_nz >> o_nz. For large problems you MUST preallocate memory
2477 or you will get TERRIBLE performance; see the users' manual chapter on
2478 matrices.
2479
2480 Level: intermediate
2481
2482.seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), PetscSplitOwnership()
2483@*/
2484PetscErrorCode MatMPISBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[])
2485{
2486 PetscErrorCode ierr;
2487
2488 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2488; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2489 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),2489,__func__
,"/sandbox/petsc/petsc.master/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),2489,__func__,"/sandbox/petsc/petsc.master/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),2489,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2489,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
2490 PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) return PetscError((
(MPI_Comm)0x44000001),2490,__func__,"/sandbox/petsc/petsc.master/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)
;
2491 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,2491,__func__,"/sandbox/petsc/petsc.master/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),2491,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)B),2491,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
2492 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 (*_7_f)(Mat,PetscInt,PetscInt,const PetscInt
[],PetscInt,const PetscInt[]), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private
(((PetscObject)(B)),("MatMPISBAIJSetPreallocation_C"),(PetscVoidFunction
*)(&_7_f));do {if (__builtin_expect(!!(_7_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),2492,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_7_f) {_7_ierr
= (*_7_f)(B,bs,d_nz,d_nnz,o_nz,o_nnz);do {if (__builtin_expect
(!!(_7_ierr),0)) return PetscError(((MPI_Comm)0x44000001),2492
,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2492,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2493 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2494}
2495
2496/*@C
2497 MatCreateSBAIJ - Creates a sparse parallel matrix in symmetric block AIJ format
2498 (block compressed row). For good matrix assembly performance
2499 the user should preallocate the matrix storage by setting the parameters
2500 d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately,
2501 performance can be increased by more than a factor of 50.
2502
2503 Collective
2504
2505 Input Parameters:
2506+ comm - MPI communicator
2507. bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row
2508 blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()
2509. m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
2510 This value should be the same as the local size used in creating the
2511 y vector for the matrix-vector product y = Ax.
2512. n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
2513 This value should be the same as the local size used in creating the
2514 x vector for the matrix-vector product y = Ax.
2515. M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
2516. N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
2517. d_nz - number of block nonzeros per block row in diagonal portion of local
2518 submatrix (same for all local rows)
2519. d_nnz - array containing the number of block nonzeros in the various block rows
2520 in the upper triangular portion of the in diagonal portion of the local
2521 (possibly different for each block block row) or NULL.
2522 If you plan to factor the matrix you must leave room for the diagonal entry and
2523 set its value even if it is zero.
2524. o_nz - number of block nonzeros per block row in the off-diagonal portion of local
2525 submatrix (same for all local rows).
2526- o_nnz - array containing the number of nonzeros in the various block rows of the
2527 off-diagonal portion of the local submatrix (possibly different for
2528 each block row) or NULL.
2529
2530 Output Parameter:
2531. A - the matrix
2532
2533 Options Database Keys:
2534+ -mat_no_unroll - uses code that does not unroll the loops in the
2535 block calculations (much slower)
2536. -mat_block_size - size of the blocks to use
2537- -mat_mpi - use the parallel matrix data structures even on one processor
2538 (defaults to using SeqBAIJ format on one processor)
2539
2540 It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(),
2541 MatXXXXSetPreallocation() paradigm instead of this routine directly.
2542 [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation]
2543
2544 Notes:
2545 The number of rows and columns must be divisible by blocksize.
2546 This matrix type does not support complex Hermitian operation.
2547
2548 The user MUST specify either the local or global matrix dimensions
2549 (possibly both).
2550
2551 If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor
2552 than it must be used on all processors that share the object for that argument.
2553
2554 If the *_nnz parameter is given then the *_nz parameter is ignored
2555
2556 Storage Information:
2557 For a square global matrix we define each processor's diagonal portion
2558 to be its local rows and the corresponding columns (a square submatrix);
2559 each processor's off-diagonal portion encompasses the remainder of the
2560 local matrix (a rectangular submatrix).
2561
2562 The user can specify preallocated storage for the diagonal part of
2563 the local submatrix with either d_nz or d_nnz (not both). Set
2564 d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic
2565 memory allocation. Likewise, specify preallocated storage for the
2566 off-diagonal part of the local submatrix with o_nz or o_nnz (not both).
2567
2568 Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In
2569 the figure below we depict these three local rows and all columns (0-11).
2570
2571.vb
2572 0 1 2 3 4 5 6 7 8 9 10 11
2573 --------------------------
2574 row 3 |. . . d d d o o o o o o
2575 row 4 |. . . d d d o o o o o o
2576 row 5 |. . . d d d o o o o o o
2577 --------------------------
2578.ve
2579
2580 Thus, any entries in the d locations are stored in the d (diagonal)
2581 submatrix, and any entries in the o locations are stored in the
2582 o (off-diagonal) submatrix. Note that the d matrix is stored in
2583 MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format.
2584
2585 Now d_nz should indicate the number of block nonzeros per row in the upper triangular
2586 plus the diagonal part of the d matrix,
2587 and o_nz should indicate the number of block nonzeros per row in the o matrix.
2588 In general, for PDE problems in which most nonzeros are near the diagonal,
2589 one expects d_nz >> o_nz. For large problems you MUST preallocate memory
2590 or you will get TERRIBLE performance; see the users' manual chapter on
2591 matrices.
2592
2593 Level: intermediate
2594
2595.seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ()
2596@*/
2597
2598PetscErrorCode 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)
2599{
2600 PetscErrorCode ierr;
2601 PetscMPIInt size;
2602
2603 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2603; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2604 ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2604,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2605 ierr = MatSetSizes(*A,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2605,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2606 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2606,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2607 if (size > 1) {
2608 ierr = MatSetType(*A,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2608,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2609 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),2609,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2610 } else {
2611 ierr = MatSetType(*A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2611,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2612 ierr = MatSeqSBAIJSetPreallocation(*A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2612,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2613 }
2614 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2615}
2616
2617
2618static PetscErrorCode MatDuplicate_MPISBAIJ(Mat matin,MatDuplicateOption cpvalues,Mat *newmat)
2619{
2620 Mat mat;
2621 Mat_MPISBAIJ *a,*oldmat = (Mat_MPISBAIJ*)matin->data;
2622 PetscErrorCode ierr;
2623 PetscInt len=0,nt,bs=matin->rmap->bs,mbs=oldmat->mbs;
2624 PetscScalar *array;
2625
2626 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2626; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2627 *newmat = 0;
2628
2629 ierr = MatCreate(PetscObjectComm((PetscObject)matin),&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2629,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2630 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),2630,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2631 ierr = MatSetType(mat,((PetscObject)matin)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2631,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2632 ierr = PetscLayoutReference(matin->rmap,&mat->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2632,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2633 ierr = PetscLayoutReference(matin->cmap,&mat->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2633,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2634
2635 mat->factortype = matin->factortype;
2636 mat->preallocated = PETSC_TRUE;
2637 mat->assembled = PETSC_TRUE;
2638 mat->insertmode = NOT_SET_VALUES;
2639
2640 a = (Mat_MPISBAIJ*)mat->data;
2641 a->bs2 = oldmat->bs2;
2642 a->mbs = oldmat->mbs;
2643 a->nbs = oldmat->nbs;
2644 a->Mbs = oldmat->Mbs;
2645 a->Nbs = oldmat->Nbs;
2646
2647 a->size = oldmat->size;
2648 a->rank = oldmat->rank;
2649 a->donotstash = oldmat->donotstash;
2650 a->roworiented = oldmat->roworiented;
2651 a->rowindices = 0;
2652 a->rowvalues = 0;
2653 a->getrowactive = PETSC_FALSE;
2654 a->barray = 0;
2655 a->rstartbs = oldmat->rstartbs;
2656 a->rendbs = oldmat->rendbs;
2657 a->cstartbs = oldmat->cstartbs;
2658 a->cendbs = oldmat->cendbs;
2659
2660 /* hash table stuff */
2661 a->ht = 0;
2662 a->hd = 0;
2663 a->ht_size = 0;
2664 a->ht_flag = oldmat->ht_flag;
2665 a->ht_fact = oldmat->ht_fact;
2666 a->ht_total_ct = 0;
2667 a->ht_insert_ct = 0;
2668
2669 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),2669,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2670 if (oldmat->colmap) {
2671#if defined(PETSC_USE_CTABLE1)
2672 ierr = PetscTableCreateCopy(oldmat->colmap,&a->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2672,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2673#else
2674 ierr = PetscMalloc1(a->Nbs,&a->colmap)PetscMallocA(1,PETSC_FALSE,2674,__func__,"/sandbox/petsc/petsc.master/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),2674,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2675 ierr = PetscLogObjectMemory((PetscObject)mat,(a->Nbs)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2675,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2676 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),2676,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2677#endif
2678 } else a->colmap = 0;
2679
2680 if (oldmat->garray && (len = ((Mat_SeqBAIJ*)(oldmat->B->data))->nbs)) {
2681 ierr = PetscMalloc1(len,&a->garray)PetscMallocA(1,PETSC_FALSE,2681,__func__,"/sandbox/petsc/petsc.master/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),2681,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2682 ierr = PetscLogObjectMemory((PetscObject)mat,len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2682,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2683 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),2683,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2684 } else a->garray = 0;
2685
2686 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)matin),matin->rmap->bs,&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2686,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2687 ierr = VecDuplicate(oldmat->lvec,&a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2687,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2688 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2688,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2689 ierr = VecScatterCopy(oldmat->Mvctx,&a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2689,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2690 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2690,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2691
2692 ierr = VecDuplicate(oldmat->slvec0,&a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2692,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2693 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2693,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2694 ierr = VecDuplicate(oldmat->slvec1,&a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2694,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2695 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2695,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2696
2697 ierr = VecGetLocalSize(a->slvec1,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2697,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2698 ierr = VecGetArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2698,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2699 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),2699,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2700 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),2700,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2701 ierr = VecRestoreArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2701,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2702 ierr = VecGetArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2702,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2703 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),2703,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2704 ierr = VecRestoreArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2704,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2705 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2705,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2706 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2706,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2707 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2707,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2708 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2708,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2709 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2709,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2710
2711 /* ierr = VecScatterCopy(oldmat->sMvctx,&a->sMvctx); - not written yet, replaced by the lazy trick: */
2712 ierr = PetscObjectReference((PetscObject)oldmat->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2712,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2713 a->sMvctx = oldmat->sMvctx;
2714 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2714,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2715
2716 ierr = MatDuplicate(oldmat->A,cpvalues,&a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2716,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2717 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2717,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2718 ierr = MatDuplicate(oldmat->B,cpvalues,&a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2718,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2719 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2719,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2720 ierr = PetscFunctionListDuplicate(((PetscObject)matin)->qlist,&((PetscObject)mat)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2720,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2721 *newmat = mat;
2722 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2723}
2724
2725PetscErrorCode MatLoad_MPISBAIJ(Mat newmat,PetscViewer viewer)
2726{
2727 PetscErrorCode ierr;
2728 PetscInt i,nz,j,rstart,rend;
2729 PetscScalar *vals,*buf;
2730 MPI_Comm comm;
2731 MPI_Status status;
2732 PetscMPIInt rank,size,tag = ((PetscObject)viewer)->tag,*sndcounts = 0,*browners,maxnz,*rowners,mmbs;
2733 PetscInt header[4],*rowlengths = 0,M,N,m,*cols,*locrowlens;
2734 PetscInt *procsnz = 0,jj,*mycols,*ibuf;
2735 PetscInt bs = newmat->rmap->bs,Mbs,mbs,extra_rows;
2736 PetscInt *dlens,*odlens,*mask,*masked1,*masked2,rowcount,odcount;
2737 PetscInt dcount,kmax,k,nzcount,tmp;
2738 int fd;
2739 PetscBool isbinary;
2740
2741 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2741; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2742 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2742,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2743 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),2743,__func__
,"/sandbox/petsc/petsc.master/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)
;
2744
2745 /* force binary viewer to load .info file if it has not yet done so */
2746 ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2746,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2747 ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2747,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2748 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),2748
,__func__,"/sandbox/petsc/petsc.master/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),2748,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2749 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),2749,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2750 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2750,__func__,"/sandbox/petsc/petsc.master/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),2750,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2751 if (bs < 0) bs = 1;
2752
2753 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2753,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2754 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2754,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2755 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2755,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2756 if (!rank) {
2757 ierr = PetscBinaryRead(fd,(char*)header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2757,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2758 if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object")return PetscError(((MPI_Comm)0x44000001),2758,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"not matrix object")
;
2759 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),2759,__func__
,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"Matrix stored in special format, cannot load as MPISBAIJ"
)
;
2760 }
2761
2762 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),2762,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2763 M = header[1];
2764 N = header[2];
2765
2766 /* If global sizes are set, check if they are consistent with that given in the file */
2767 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),2767,__func__,"/sandbox/petsc/petsc.master/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)
;
2768 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),2768,__func__,"/sandbox/petsc/petsc.master/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)
;
2769
2770 if (M != N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Can only do square matrices")return PetscError(((MPI_Comm)0x44000001),2770,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Can only do square matrices")
;
2771
2772 /*
2773 This code adds extra rows to make sure the number of rows is
2774 divisible by the blocksize
2775 */
2776 Mbs = M/bs;
2777 extra_rows = bs - M + bs*(Mbs);
2778 if (extra_rows == bs) extra_rows = 0;
2779 else Mbs++;
2780 if (extra_rows &&!rank) {
2781 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),2781,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2782 }
2783
2784 /* determine ownership of all rows */
2785 if (newmat->rmap->n < 0) { /* PETSC_DECIDE */
2786 mbs = Mbs/size + ((Mbs % size) > rank);
2787 m = mbs*bs;
2788 } else { /* User Set */
2789 m = newmat->rmap->n;
2790 mbs = m/bs;
2791 }
2792 ierr = PetscMalloc2(size+1,&rowners,size+1,&browners)PetscMallocA(2,PETSC_FALSE,2792,__func__,"/sandbox/petsc/petsc.master/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),2792,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2793 ierr = PetscMPIIntCast(mbs,&mmbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2793,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2794 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),2794,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2795 rowners[0] = 0;
2796 for (i=2; i<=size; i++) rowners[i] += rowners[i-1];
2797 for (i=0; i<=size; i++) browners[i] = rowners[i]*bs;
2798 rstart = rowners[rank];
2799 rend = rowners[rank+1];
2800
2801 /* distribute row lengths to all processors */
2802 ierr = PetscMalloc1((rend-rstart)*bs,&locrowlens)PetscMallocA(1,PETSC_FALSE,2802,__func__,"/sandbox/petsc/petsc.master/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),2802,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2803 if (!rank) {
2804 ierr = PetscMalloc1(M+extra_rows,&rowlengths)PetscMallocA(1,PETSC_FALSE,2804,__func__,"/sandbox/petsc/petsc.master/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),2804,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2805 ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2805,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2806 for (i=0; i<extra_rows; i++) rowlengths[M+i] = 1;
2807 ierr = PetscMalloc1(size,&sndcounts)PetscMallocA(1,PETSC_FALSE,2807,__func__,"/sandbox/petsc/petsc.master/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),2807,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2808 for (i=0; i<size; i++) sndcounts[i] = browners[i+1] - browners[i];
2809 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),2809,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2810 ierr = PetscFree(sndcounts)((*PetscTrFree)((void*)(sndcounts),2810,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((sndcounts) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2810,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2811 } else {
2812 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),2812,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2813 }
2814
2815 if (!rank) { /* procs[0] */
2816 /* calculate the number of nonzeros on each processor */
2817 ierr = PetscCalloc1(size,&procsnz)PetscMallocA(1,PETSC_TRUE,2817,__func__,"/sandbox/petsc/petsc.master/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),2817,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2818 for (i=0; i<size; i++) {
2819 for (j=rowners[i]*bs; j< rowners[i+1]*bs; j++) {
2820 procsnz[i] += rowlengths[j];
2821 }
2822 }
2823 ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),2823,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((rowlengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2823,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2824
2825 /* determine max buffer needed and allocate it */
2826 maxnz = 0;
2827 for (i=0; i<size; i++) {
2828 maxnz = PetscMax(maxnz,procsnz[i])(((maxnz)<(procsnz[i])) ? (procsnz[i]) : (maxnz));
2829 }
2830 ierr = PetscMalloc1(maxnz,&cols)PetscMallocA(1,PETSC_FALSE,2830,__func__,"/sandbox/petsc/petsc.master/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),2830,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2831
2832 /* read in my part of the matrix column indices */
2833 nz = procsnz[0];
2834 ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2834,__func__,"/sandbox/petsc/petsc.master/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),2834,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2835 mycols = ibuf;
2836 if (size == 1) nz -= extra_rows;
2837 ierr = PetscBinaryRead(fd,mycols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2837,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2838 if (size == 1) {
2839 for (i=0; i< extra_rows; i++) mycols[nz+i] = M+i;
2840 }
2841
2842 /* read in every ones (except the last) and ship off */
2843 for (i=1; i<size-1; i++) {
2844 nz = procsnz[i];
2845 ierr = PetscBinaryRead(fd,cols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2845,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2846 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),2846,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2847 }
2848 /* read in the stuff for the last proc */
2849 if (size != 1) {
2850 nz = procsnz[size-1] - extra_rows; /* the extra rows are not on the disk */
2851 ierr = PetscBinaryRead(fd,cols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2851,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2852 for (i=0; i<extra_rows; i++) cols[nz+i] = M+i;
2853 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),2853,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2854 }
2855 ierr = PetscFree(cols)((*PetscTrFree)((void*)(cols),2855,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((cols) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2855,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2856 } else { /* procs[i], i>0 */
2857 /* determine buffer space needed for message */
2858 nz = 0;
2859 for (i=0; i<m; i++) nz += locrowlens[i];
2860 ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2860,__func__,"/sandbox/petsc/petsc.master/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),2860,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2861 mycols = ibuf;
2862 /* receive message of column indices*/
2863 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),2863,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2864 ierr = MPI_Get_count(&status,MPIU_INT((MPI_Datatype)0x4c000405),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2864,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2865 if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2865,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"something is wrong with file")
;
2866 }
2867
2868 /* loop over local rows, determining number of off diagonal entries */
2869 ierr = PetscMalloc2(rend-rstart,&dlens,rend-rstart,&odlens)PetscMallocA(2,PETSC_FALSE,2869,__func__,"/sandbox/petsc/petsc.master/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),2869,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2870 ierr = PetscCalloc3(Mbs,&mask,Mbs,&masked1,Mbs,&masked2)PetscMallocA(3,PETSC_TRUE,2870,__func__,"/sandbox/petsc/petsc.master/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),2870,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2871 rowcount = 0;
2872 nzcount = 0;
2873 for (i=0; i<mbs; i++) {
2874 dcount = 0;
2875 odcount = 0;
2876 for (j=0; j<bs; j++) {
2877 kmax = locrowlens[rowcount];
2878 for (k=0; k<kmax; k++) {
2879 tmp = mycols[nzcount++]/bs; /* block col. index */
2880 if (!mask[tmp]) {
2881 mask[tmp] = 1;
2882 if (tmp < rstart || tmp >= rend) masked2[odcount++] = tmp; /* entry in off-diag portion */
2883 else masked1[dcount++] = tmp; /* entry in diag portion */
2884 }
2885 }
2886 rowcount++;
2887 }
2888
2889 dlens[i] = dcount; /* d_nzz[i] */
2890 odlens[i] = odcount; /* o_nzz[i] */
2891
2892 /* zero out the mask elements we set */
2893 for (j=0; j<dcount; j++) mask[masked1[j]] = 0;
2894 for (j=0; j<odcount; j++) mask[masked2[j]] = 0;
2895 }
2896 ierr = MatSetSizes(newmat,m,m,M+extra_rows,N+extra_rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2896,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2897 ierr = MatMPISBAIJSetPreallocation(newmat,bs,0,dlens,0,odlens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2897,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2898 ierr = MatSetOption(newmat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2898,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2899
2900 if (!rank) {
2901 ierr = PetscMalloc1(maxnz,&buf)PetscMallocA(1,PETSC_FALSE,2901,__func__,"/sandbox/petsc/petsc.master/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),2901,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2902 /* read in my part of the matrix numerical values */
2903 nz = procsnz[0];
2904 vals = buf;
2905 mycols = ibuf;
2906 if (size == 1) nz -= extra_rows;
2907 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2907,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2908 if (size == 1) {
2909 for (i=0; i< extra_rows; i++) vals[nz+i] = 1.0;
2910 }
2911
2912 /* insert into matrix */
2913 jj = rstart*bs;
2914 for (i=0; i<m; i++) {
2915 ierr = MatSetValues(newmat,1,&jj,locrowlens[i],mycols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2915,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2916 mycols += locrowlens[i];
2917 vals += locrowlens[i];
2918 jj++;
2919 }
2920
2921 /* read in other processors (except the last one) and ship out */
2922 for (i=1; i<size-1; i++) {
2923 nz = procsnz[i];
2924 vals = buf;
2925 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2925,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2926 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),2926,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2927 }
2928 /* the last proc */
2929 if (size != 1) {
2930 nz = procsnz[i] - extra_rows;
2931 vals = buf;
2932 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2932,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2933 for (i=0; i<extra_rows; i++) vals[nz+i] = 1.0;
2934 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),2934,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2935 }
2936 ierr = PetscFree(procsnz)((*PetscTrFree)((void*)(procsnz),2936,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((procsnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2936,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2937
2938 } else {
2939 /* receive numeric values */
2940 ierr = PetscMalloc1(nz,&buf)PetscMallocA(1,PETSC_FALSE,2940,__func__,"/sandbox/petsc/petsc.master/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),2940,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2941
2942 /* receive message of values*/
2943 vals = buf;
2944 mycols = ibuf;
2945 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),2945,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2946 ierr = MPI_Get_count(&status,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2946,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2947 if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2947,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"something is wrong with file")
;
2948
2949 /* insert into matrix */
2950 jj = rstart*bs;
2951 for (i=0; i<m; i++) {
2952 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),2952,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2953 mycols += locrowlens[i];
2954 vals += locrowlens[i];
2955 jj++;
2956 }
2957 }
2958
2959 ierr = PetscFree(locrowlens)((*PetscTrFree)((void*)(locrowlens),2959,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((locrowlens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2959,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2960 ierr = PetscFree(buf)((*PetscTrFree)((void*)(buf),2960,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((buf) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2960,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2961 ierr = PetscFree(ibuf)((*PetscTrFree)((void*)(ibuf),2961,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((ibuf) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2961,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2962 ierr = PetscFree2(rowners,browners)PetscFreeA(2,2962,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(rowners),&(browners))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2962,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2963 ierr = PetscFree2(dlens,odlens)PetscFreeA(2,2963,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(dlens),&(odlens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2963,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2964 ierr = PetscFree3(mask,masked1,masked2)PetscFreeA(3,2964,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(mask),&(masked1),&(masked2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2964,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2965 ierr = MatAssemblyBegin(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2965,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2966 ierr = MatAssemblyEnd(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2966,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2967 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2968}
2969
2970/*XXXXX@
2971 MatMPISBAIJSetHashTableFactor - Sets the factor required to compute the size of the HashTable.
2972
2973 Input Parameters:
2974. mat - the matrix
2975. fact - factor
2976
2977 Not Collective on Mat, each process can have a different hash factor
2978
2979 Level: advanced
2980
2981 Notes:
2982 This can also be set by the command line option: -mat_use_hash_table fact
2983
2984.seealso: MatSetOption()
2985@XXXXX*/
2986
2987
2988PetscErrorCode MatGetRowMaxAbs_MPISBAIJ(Mat A,Vec v,PetscInt idx[])
2989{
2990 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
2991 Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)(a->B)->data;
2992 PetscReal atmp;
2993 PetscReal *work,*svalues,*rvalues;
2994 PetscErrorCode ierr;
2995 PetscInt i,bs,mbs,*bi,*bj,brow,j,ncols,krow,kcol,col,row,Mbs,bcol;
2996 PetscMPIInt rank,size;
2997 PetscInt *rowners_bs,dest,count,source;
2998 PetscScalar *va;
2999 MatScalar *ba;
3000 MPI_Status stat;
3001
3002 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3002; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3003 if (idx) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Send email to [email protected]")return PetscError(((MPI_Comm)0x44000001),3003,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Send email to [email protected]"
)
;
3004 ierr = MatGetRowMaxAbs(a->A,v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3004,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3005 ierr = VecGetArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3005,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3006
3007 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3007,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3008 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3008,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3009
3010 bs = A->rmap->bs;
3011 mbs = a->mbs;
3012 Mbs = a->Mbs;
3013 ba = b->a;
3014 bi = b->i;
3015 bj = b->j;
3016
3017 /* find ownerships */
3018 rowners_bs = A->rmap->range;
3019
3020 /* each proc creates an array to be distributed */
3021 ierr = PetscCalloc1(bs*Mbs,&work)PetscMallocA(1,PETSC_TRUE,3021,__func__,"/sandbox/petsc/petsc.master/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),3021,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3022
3023 /* row_max for B */
3024 if (rank != size-1) {
3025 for (i=0; i<mbs; i++) {
3026 ncols = bi[1] - bi[0]; bi++;
3027 brow = bs*i;
3028 for (j=0; j<ncols; j++) {
3029 bcol = bs*(*bj);
3030 for (kcol=0; kcol<bs; kcol++) {
3031 col = bcol + kcol; /* local col index */
3032 col += rowners_bs[rank+1]; /* global col index */
3033 for (krow=0; krow<bs; krow++) {
3034 atmp = PetscAbsScalar(*ba)fabs(*ba); ba++;
3035 row = brow + krow; /* local row index */
3036 if (PetscRealPart(va[row])(va[row]) < atmp) va[row] = atmp;
3037 if (work[col] < atmp) work[col] = atmp;
3038 }
3039 }
3040 bj++;
3041 }
3042 }
3043
3044 /* send values to its owners */
3045 for (dest=rank+1; dest<size; dest++) {
3046 svalues = work + rowners_bs[dest];
3047 count = rowners_bs[dest+1]-rowners_bs[dest];
3048 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),3048,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3049 }
3050 }
3051
3052 /* receive values */
3053 if (rank) {
3054 rvalues = work;
3055 count = rowners_bs[rank+1]-rowners_bs[rank];
3056 for (source=0; source<rank; source++) {
3057 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),3057,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3058 /* process values */
3059 for (i=0; i<count; i++) {
3060 if (PetscRealPart(va[i])(va[i]) < rvalues[i]) va[i] = rvalues[i];
3061 }
3062 }
3063 }
3064
3065 ierr = VecRestoreArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3065,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3066 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),3066,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3066,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3067 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3068}
3069
3070PetscErrorCode MatSOR_MPISBAIJ(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
3071{
3072 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
3073 PetscErrorCode ierr;
3074 PetscInt mbs=mat->mbs,bs=matin->rmap->bs;
3075 PetscScalar *x,*ptr,*from;
3076 Vec bb1;
3077 const PetscScalar *b;
3078
3079 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3079; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3080 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),3080,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive"
,its,lits)
;
3081 if (bs > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SSOR for block size > 1 is not yet implemented")return PetscError(((MPI_Comm)0x44000001),3081,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented"
)
;
3082
3083 if (flag == SOR_APPLY_UPPER) {
3084 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),3084,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3085 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3086 }
3087
3088 if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) {
3089 if (flag & SOR_ZERO_INITIAL_GUESS) {
3090 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),3090,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3091 its--;
3092 }
3093
3094 ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3094,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3095 while (its--) {
3096
3097 /* lower triangular part: slvec0b = - B^T*xx */
3098 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3098,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3099
3100 /* copy xx into slvec0a */
3101 ierr = VecGetArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3101,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3102 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3102,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3103 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),3103,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3104 ierr = VecRestoreArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3104,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3105
3106 ierr = VecScale(mat->slvec0,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3106,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3107
3108 /* copy bb into slvec1a */
3109 ierr = VecGetArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3109,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3110 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3110,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3111 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),3111,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3112 ierr = VecRestoreArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3112,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3113
3114 /* set slvec1b = 0 */
3115 ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3115,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3116
3117 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),3117,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3118 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3118,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3119 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3119,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3120 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),3120,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3121
3122 /* upper triangular part: bb1 = bb1 - B*x */
3123 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),3123,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3124
3125 /* local diagonal sweep */
3126 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),3126,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3127 }
3128 ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3128,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3129 } else if ((flag & SOR_LOCAL_FORWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) {
3130 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),3130,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3131 } else if ((flag & SOR_LOCAL_BACKWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) {
3132 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),3132,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3133 } else if (flag & SOR_EISENSTAT) {
3134 Vec xx1;
3135 PetscBool hasop;
3136 const PetscScalar *diag;
3137 PetscScalar *sl,scale = (omega - 2.0)/omega;
3138 PetscInt i,n;
3139
3140 if (!mat->xx1) {
3141 ierr = VecDuplicate(bb,&mat->xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3141,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3142 ierr = VecDuplicate(bb,&mat->bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3142,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3143 }
3144 xx1 = mat->xx1;
3145 bb1 = mat->bb1;
3146
3147 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),3147,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3148
3149 if (!mat->diag) {
3150 /* this is wrong for same matrix with new nonzero values */
3151 ierr = MatCreateVecs(matin,&mat->diag,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3151,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3152 ierr = MatGetDiagonal(matin,mat->diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3152,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3153 }
3154 ierr = MatHasOperation(matin,MATOP_MULT_DIAGONAL_BLOCK,&hasop);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3154,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3155
3156 if (hasop) {
3157 ierr = MatMultDiagonalBlock(matin,xx,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3157,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3158 ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3158,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3159 } else {
3160 /*
3161 These two lines are replaced by code that may be a bit faster for a good compiler
3162 ierr = VecPointwiseMult(mat->slvec1a,mat->diag,xx);CHKERRQ(ierr);
3163 ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr);
3164 */
3165 ierr = VecGetArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3165,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3166 ierr = VecGetArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3166,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3167 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3167,__func__,"/sandbox/petsc/petsc.master/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.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3169 ierr = VecGetLocalSize(xx,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3169,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3170 if (omega == 1.0) {
3171 for (i=0; i<n; i++) sl[i] = b[i] - diag[i]*x[i];
3172 ierr = PetscLogFlops(2.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3172,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3173 } else {
3174 for (i=0; i<n; i++) sl[i] = b[i] + scale*diag[i]*x[i];
3175 ierr = PetscLogFlops(3.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3175,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3176 }
3177 ierr = VecRestoreArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3177,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3178 ierr = VecRestoreArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3178,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3179 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3179,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3180 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3180,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3181 }
3182
3183 /* multiply off-diagonal portion of matrix */
3184 ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3184,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3185 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3185,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3186 ierr = VecGetArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3186,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3187 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3187,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3188 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),3188,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3189 ierr = VecRestoreArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3189,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3190 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3190,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3191 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),3191,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3192 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),3192,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3193 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),3193,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3194
3195 /* local sweep */
3196 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),3196,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3197 ierr = VecAXPY(xx,1.0,xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3197,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3198 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3198,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format"
)
;
3199 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3200}
3201
3202PetscErrorCode MatSOR_MPISBAIJ_2comm(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
3203{
3204 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
3205 PetscErrorCode ierr;
3206 Vec lvec1,bb1;
3207
3208 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3208; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3209 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),3209,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive"
,its,lits)
;
3210 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),3210,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented"
)
;
3211
3212 if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) {
3213 if (flag & SOR_ZERO_INITIAL_GUESS) {
3214 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),3214,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3215 its--;
3216 }
3217
3218 ierr = VecDuplicate(mat->lvec,&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3218,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3219 ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3219,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3220 while (its--) {
3221 ierr = VecScatterBegin(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3221,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3222
3223 /* lower diagonal part: bb1 = bb - B^T*xx */
3224 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3224,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3225 ierr = VecScale(lvec1,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3225,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3226
3227 ierr = VecScatterEnd(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3227,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3228 ierr = VecCopy(bb,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3228,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3229 ierr = VecScatterBegin(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3229,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3230
3231 /* upper diagonal part: bb1 = bb1 - B*x */
3232 ierr = VecScale(mat->lvec,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3232,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3233 ierr = (*mat->B->ops->multadd)(mat->B,mat->lvec,bb1,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3233,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3234
3235 ierr = VecScatterEnd(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3235,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3236
3237 /* diagonal sweep */
3238 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),3238,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3239 }
3240 ierr = VecDestroy(&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3240,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3241 ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3241,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3242 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3242,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format"
)
;
3243 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3244}
3245
3246/*@
3247 MatCreateMPISBAIJWithArrays - creates a MPI SBAIJ matrix using arrays that contain in standard
3248 CSR format the local rows.
3249
3250 Collective
3251
3252 Input Parameters:
3253+ comm - MPI communicator
3254. bs - the block size, only a block size of 1 is supported
3255. m - number of local rows (Cannot be PETSC_DECIDE)
3256. n - This value should be the same as the local size used in creating the
3257 x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have
3258 calculated if N is given) For square matrices n is almost always m.
3259. M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
3260. N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
3261. 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
3262. j - column indices
3263- a - matrix values
3264
3265 Output Parameter:
3266. mat - the matrix
3267
3268 Level: intermediate
3269
3270 Notes:
3271 The i, j, and a arrays ARE copied by this routine into the internal format used by PETSc;
3272 thus you CANNOT change the matrix entries by changing the values of a[] after you have
3273 called this routine. Use MatCreateMPIAIJWithSplitArrays() to avoid needing to copy the arrays.
3274
3275 The i and j indices are 0 based, and i indices are indices corresponding to the local j array.
3276
3277.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(),
3278 MPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays()
3279@*/
3280PetscErrorCode 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)
3281{
3282 PetscErrorCode ierr;
3283
3284
3285 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3285; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3286 if (i[0]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"i (row indices) must start with 0")return PetscError(((MPI_Comm)0x44000001),3286,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0")
;
3287 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),3287,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"local number of rows (m) cannot be PETSC_DECIDE, or negative"
)
;
3288 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3288,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3289 ierr = MatSetSizes(*mat,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3289,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3290 ierr = MatSetType(*mat,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3290,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3291 ierr = MatMPISBAIJSetPreallocationCSR(*mat,bs,i,j,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3291,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3292 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3293}
3294
3295
3296/*@C
3297 MatMPISBAIJSetPreallocationCSR - Creates a sparse parallel matrix in SBAIJ format using the given nonzero structure and (optional) numerical values
3298
3299 Collective
3300
3301 Input Parameters:
3302+ B - the matrix
3303. bs - the block size
3304. i - the indices into j for the start of each local row (starts with zero)
3305. j - the column indices for each local row (starts with zero) these must be sorted for each row
3306- v - optional values in the matrix
3307
3308 Level: advanced
3309
3310 Notes:
3311 Though this routine has Preallocation() in the name it also sets the exact nonzero locations of the matrix entries
3312 and usually the numerical values as well
3313
3314 Any entries below the diagonal are ignored
3315
3316.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MPIAIJ
3317@*/
3318PetscErrorCode MatMPISBAIJSetPreallocationCSR(Mat B,PetscInt bs,const PetscInt i[],const PetscInt j[], const PetscScalar v[])
3319{
3320 PetscErrorCode ierr;
3321
3322 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3322; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3323 ierr = PetscTryMethod(B,"MatMPISBAIJSetPreallocationCSR_C",(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,bs,i,j,v))0; do { PetscErrorCode (*_7_f)(Mat,PetscInt,const PetscInt[],
const PetscInt[],const PetscScalar[]), _7_ierr; _7_ierr = PetscObjectQueryFunction_Private
(((PetscObject)(B)),("MatMPISBAIJSetPreallocationCSR_C"),(PetscVoidFunction
*)(&_7_f));do {if (__builtin_expect(!!(_7_ierr),0)) return
PetscError(((MPI_Comm)0x44000001),3323,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (_7_f) {_7_ierr
= (*_7_f)(B,bs,i,j,v);do {if (__builtin_expect(!!(_7_ierr),0
)) return PetscError(((MPI_Comm)0x44000001),3323,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3323,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3324 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3325}
3326
3327PetscErrorCode MatCreateMPIMatConcatenateSeqMat_MPISBAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat)
3328{
3329 PetscErrorCode ierr;
3330 PetscInt m,N,i,rstart,nnz,Ii,bs,cbs;
3331 PetscInt *indx;
3332 PetscScalar *values;
3333
3334 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3334; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3335 ierr = MatGetSize(inmat,&m,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3335,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3336 if (scall == MAT_INITIAL_MATRIX) { /* symbolic phase */
3337 Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)inmat->data;
3338 PetscInt *dnz,*onz,mbs,Nbs,nbs;
3339 PetscInt *bindx,rmax=a->rmax,j;
3340 PetscMPIInt rank,size;
3341
3342 ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3342,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3343 mbs = m/bs; Nbs = N/cbs;
3344 if (n == PETSC_DECIDE-1) {
3345 ierr = PetscSplitOwnershipBlock(comm,cbs,&n,&N);
3346 }
3347 nbs = n/cbs;
3348
3349 ierr = PetscMalloc1(rmax,&bindx)PetscMallocA(1,PETSC_FALSE,3349,__func__,"/sandbox/petsc/petsc.master/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),3349,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3350 ierr = MatPreallocateInitialize(comm,mbs,nbs,dnz,onz)0; do { PetscErrorCode _4_ierr; PetscInt __nrows = (mbs),__ncols
= (nbs),__rstart,__start,__end; _4_ierr = PetscMallocA(2,PETSC_TRUE
,3350,__func__,"/sandbox/petsc/petsc.master/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),3350
,__func__,"/sandbox/petsc/petsc.master/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),3350
,__func__,"/sandbox/petsc/petsc.master/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),3350,__func__,"/sandbox/petsc/petsc.master/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),3350,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* inline function, output __end and __rstart are used below */
3351
3352 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3352,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3353 ierr = MPI_Comm_rank(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3353,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3354 if (rank == size-1) {
3355 /* Check sum(nbs) = Nbs */
3356 if (__end != Nbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Sum of local block columns %D != global block columns %D",__end,Nbs)return PetscError(((MPI_Comm)0x44000001),3356,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,75,PETSC_ERROR_INITIAL,"Sum of local block columns %D != global block columns %D"
,__end,Nbs)
;
3357 }
3358
3359 rstart = __rstart; /* block rstart of *outmat; see inline function MatPreallocateInitialize */
3360 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3360,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3361 for (i=0; i<mbs; i++) {
3362 ierr = MatGetRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3362,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* non-blocked nnz and indx */
3363 nnz = nnz/bs;
3364 for (j=0; j<nnz; j++) bindx[j] = indx[j*bs]/bs;
3365 ierr = MatPreallocateSet(i+rstart,nnz,bindx,dnz,onz)0;do { PetscInt __i; if (i+rstart < __rstart) return PetscError
(((MPI_Comm)0x44000001),3365,__func__,"/sandbox/petsc/petsc.master/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),3365,__func__,"/sandbox/petsc/petsc.master/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),3365,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3366 ierr = MatRestoreRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3366,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3367 }
3368 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3368,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3369 ierr = PetscFree(bindx)((*PetscTrFree)((void*)(bindx),3369,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((bindx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3369,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3370
3371 ierr = MatCreate(comm,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3371,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3372 ierr = MatSetSizes(*outmat,m,n,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3372,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3373 ierr = MatSetBlockSizes(*outmat,bs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3373,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3374 ierr = MatSetType(*outmat,MATSBAIJ"sbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3374,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3375 ierr = MatSeqSBAIJSetPreallocation(*outmat,bs,0,dnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3375,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3376 ierr = MatMPISBAIJSetPreallocation(*outmat,bs,0,dnz,0,onz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3376,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3377 ierr = MatPreallocateFinalize(dnz,onz)0;_4_ierr = PetscFreeA(2,3377,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(dnz),&(onz));do {if (__builtin_expect(!!(_4_ierr),
0)) return PetscError(((MPI_Comm)0x44000001),3377,__func__,"/sandbox/petsc/petsc.master/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),3377,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3378 }
3379
3380 /* numeric phase */
3381 ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3381,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3382 ierr = MatGetOwnershipRange(*outmat,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3382,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3383
3384 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3384,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3385 for (i=0; i<m; i++) {
3386 ierr = MatGetRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3386,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3387 Ii = i + rstart;
3388 ierr = MatSetValues(*outmat,1,&Ii,nnz,indx,values,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3388,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3389 ierr = MatRestoreRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3389,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3390 }
3391 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3391,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3392 ierr = MatAssemblyBegin(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3392,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3393 ierr = MatAssemblyEnd(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3393,__func__,"/sandbox/petsc/petsc.master/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3394 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3395}

/sandbox/petsc/petsc.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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