Bug Summary

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

Annotated Source Code

[?] Use j/k keys for keyboard navigation

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

1
2#include <../src/mat/impls/baij/mpi/mpibaij.h> /*I "petscmat.h" I*/
3#include <../src/mat/impls/sbaij/mpi/mpisbaij.h>
4#include <../src/mat/impls/sbaij/seq/sbaij.h>
5#include <petscblaslapack.h>
6
7#if defined(PETSC_HAVE_ELEMENTAL)
8PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_MPISBAIJ_Elemental(Mat,MatType,MatReuse,Mat*);
9#endif
10
11/* This could be moved to matimpl.h */
12static PetscErrorCode MatPreallocateWithMats_Private(Mat B, PetscInt nm, Mat X[], PetscBool symm[], PetscBool fill)
13{
14 Mat preallocator;
15 PetscInt r,rstart,rend;
16 PetscInt bs,i,m,n,M,N;
17 PetscBool cong = PETSC_TRUE;
18 PetscErrorCode ierr;
19
20 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 20; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
21 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),21,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),21,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if (
((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),21,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),21,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
22 PetscValidLogicalCollectiveInt(B,nm,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nm
; b1[1] = nm; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)B),2,22,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),22,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)B),22,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
23 for (i = 0; i < nm; i++) {
24 PetscValidHeaderSpecific(X[i],MAT_CLASSID,3)do { if (!X[i]) return PetscError(((MPI_Comm)0x44000001),24,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(X[i],PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),24,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(X[i]))->classid != MAT_CLASSID) { if
(((PetscObject)(X[i]))->classid == -1) return PetscError(
((MPI_Comm)0x44000001),24,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),24,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,3); } } while (0)
;
25 ierr = PetscLayoutCompare(B->rmap,X[i]->rmap,&cong);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),25,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
26 if (!cong) SETERRQ(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"Not for different layouts")return PetscError(PetscObjectComm((PetscObject)B),26,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Not for different layouts")
;
27 }
28 PetscValidLogicalCollectiveBool(B,fill,5)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)fill; b1[1] = (PetscMPIInt)fill; _7_ierr = (PetscAllreduceBarrierCheck
(PetscObjectComm((PetscObject)B),2,28,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),28,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)B),28,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,5); } while (0)
;
29 ierr = MatGetBlockSize(B,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),29,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
30 ierr = MatGetSize(B,&M,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),30,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
31 ierr = MatGetLocalSize(B,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),31,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
32 ierr = MatCreate(PetscObjectComm((PetscObject)B),&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),32,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
33 ierr = MatSetType(preallocator,MATPREALLOCATOR"preallocator");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),33,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
34 ierr = MatSetBlockSize(preallocator,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),34,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
35 ierr = MatSetSizes(preallocator,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),35,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
36 ierr = MatSetUp(preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),36,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
37 ierr = MatGetOwnershipRange(preallocator,&rstart,&rend);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),37,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
38 for (r = rstart; r < rend; ++r) {
39 PetscInt ncols;
40 const PetscInt *row;
41 const PetscScalar *vals;
42
43 for (i = 0; i < nm; i++) {
44 ierr = MatGetRow(X[i],r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),44,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
45 ierr = MatSetValues(preallocator,1,&r,ncols,row,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),45,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
46 if (symm && symm[i]) {
47 ierr = MatSetValues(preallocator,ncols,row,1,&r,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),47,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
48 }
49 ierr = MatRestoreRow(X[i],r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),49,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
50 }
51 }
52 ierr = MatAssemblyBegin(preallocator,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),52,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
53 ierr = MatAssemblyEnd(preallocator,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),53,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
54 ierr = MatPreallocatorPreallocate(preallocator,fill,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),54,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
55 ierr = MatDestroy(&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),55,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
56 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
57}
58
59static PetscErrorCode MatConvert_MPISBAIJ_XAIJ(Mat A, MatType newtype, MatReuse reuse, Mat *newmat)
60{
61 Mat B;
62 PetscErrorCode ierr;
63 PetscInt r;
64
65 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 65; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
66 if (reuse != MAT_REUSE_MATRIX) {
67 PetscBool symm = PETSC_TRUE;
68 PetscInt bs;
69
70 ierr = MatCreate(PetscObjectComm((PetscObject)A),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),70,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
71 ierr = MatSetSizes(B,A->rmap->n,A->cmap->n,A->rmap->N,A->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),71,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
72 ierr = MatSetType(B,newtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),72,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
73 ierr = MatGetBlockSize(A,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),73,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
74 ierr = MatSetBlockSize(B,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),74,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
75 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),76,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
77 ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),77,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
78 ierr = MatPreallocateWithMats_Private(B,1,&A,&symm,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),78,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
79 ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),79,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
80 } else B = *newmat;
81
82 ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),82,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
83 for (r = A->rmap->rstart; r < A->rmap->rend; r++) {
84 PetscInt ncols;
85 const PetscInt *row;
86 const PetscScalar *vals;
87
88 ierr = MatGetRow(A,r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),88,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
89 ierr = MatSetValues(B,1,&r,ncols,row,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),89,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
90 ierr = MatSetValues(B,ncols,row,1,&r,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),90,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
91 ierr = MatRestoreRow(A,r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),91,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
92 }
93 ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),93,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
94 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),94,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
95 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),95,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
96
97 if (reuse == MAT_INPLACE_MATRIX) {
98 ierr = MatHeaderReplace(A,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),98,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
99 } else {
100 *newmat = B;
101 }
102 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
103}
104
105PetscErrorCode MatStoreValues_MPISBAIJ(Mat mat)
106{
107 Mat_MPISBAIJ *aij = (Mat_MPISBAIJ*)mat->data;
108 PetscErrorCode ierr;
109
110 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 110; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
111 ierr = MatStoreValues(aij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),111,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
112 ierr = MatStoreValues(aij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
113 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
114}
115
116PetscErrorCode MatRetrieveValues_MPISBAIJ(Mat mat)
117{
118 Mat_MPISBAIJ *aij = (Mat_MPISBAIJ*)mat->data;
119 PetscErrorCode ierr;
120
121 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 121; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
122 ierr = MatRetrieveValues(aij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),122,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
123 ierr = MatRetrieveValues(aij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),123,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
124 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
125}
126
127#define MatSetValues_SeqSBAIJ_A_Private(row,col,value,addv,orow,ocol){ brow = row/bs; rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; rmax
= aimax[brow]; nrow = ailen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
a_noinsert; } } if (a->nonew == 1) goto a_noinsert; if (a
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),127
,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)A->data; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (a->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)*
sizeof(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow
]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow
]+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[brow
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(ai[brow]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[brow]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[brow]+nrow+CHUNKSIZE
),aa+bs2*(ai[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[brow
]+nrow+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow
]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));do
{if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; A->nonzerostate++;a_noinsert
:; ailen[brow] = nrow; }
\
128 { \
129 brow = row/bs; \
130 rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; \
131 rmax = aimax[brow]; nrow = ailen[brow]; \
132 bcol = col/bs; \
133 ridx = row % bs; cidx = col % bs; \
134 low = 0; high = nrow; \
135 while (high-low > 3) { \
136 t = (low+high)/2; \
137 if (rp[t] > bcol) high = t; \
138 else low = t; \
139 } \
140 for (_i=low; _i<high; _i++) { \
141 if (rp[_i] > bcol) break; \
142 if (rp[_i] == bcol) { \
143 bap = ap + bs2*_i + bs*cidx + ridx; \
144 if (addv == ADD_VALUES) *bap += value; \
145 else *bap = value; \
146 goto a_noinsert; \
147 } \
148 } \
149 if (a->nonew == 1) goto a_noinsert; \
150 if (a->nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at global row/column (%D, %D) into matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),150,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol)
; \
151 MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,brow,bcol,rmax,aa,ai,aj,rp,ap,aimax,a->nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (a->nonew == -
2) return PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,151,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),151,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)*
sizeof(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow
]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow
]+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[brow
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(ai[brow]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[brow]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[brow]+nrow+CHUNKSIZE
),aa+bs2*(ai[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[brow
]+nrow+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),151,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow
]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }
; \
152 N = nrow++ - 1; \
153 /* shift up all the later entries in this row */ \
154 ierr = PetscArraymove(rp+_i+1,rp+_i,N-_i+1)((sizeof(*(rp+_i+1)) != sizeof(*(rp+_i))) || PetscMemmove(rp+
_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i+1))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),154,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
155 ierr = PetscArraymove(ap+bs2*(_i+1),ap+bs2*_i,bs2*(N-_i+1))((sizeof(*(ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove
(ap+bs2*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1
)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),155,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
156 ierr = PetscArrayzero(ap+bs2*_i,bs2)PetscMemzero(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),156,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
157 rp[_i] = bcol; \
158 ap[bs2*_i + bs*cidx + ridx] = value; \
159 A->nonzerostate++;\
160a_noinsert:; \
161 ailen[brow] = nrow; \
162 }
163
164#define MatSetValues_SeqSBAIJ_B_Private(row,col,value,addv,orow,ocol){ brow = row/bs; rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; rmax
= bimax[brow]; nrow = bilen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
b_noinsert; } } if (b->nonew == 1) goto b_noinsert; if (b
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),164
,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)B->data; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (b->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs
+1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(bj))) || PetscMemcpy(new_j,bj,(bi[brow]+nrow)*
sizeof(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- bi[brow] - nrow); ierr = ((sizeof(*(new_j+bi[brow]+nrow+CHUNKSIZE
)) != sizeof(*(bj+bi[brow]+nrow))) || PetscMemcpy(new_j+bi[brow
]+nrow+CHUNKSIZE,bj+bi[brow]+nrow,(len)*sizeof(*(new_j+bi[brow
]+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(ba))) || PetscMemcpy(new_a,ba,(bs2*(bi[brow
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(bi[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(bi[brow]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(bi[brow]+nrow+CHUNKSIZE))) != sizeof(*(ba+bs2*(bi[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(bi[brow]+nrow+CHUNKSIZE
),ba+bs2*(bi[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(bi[brow
]+nrow+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain->
a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow
]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));do
{if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),164,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; B->nonzerostate++;b_noinsert
:; bilen[brow] = nrow; }
\
165 { \
166 brow = row/bs; \
167 rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; \
168 rmax = bimax[brow]; nrow = bilen[brow]; \
169 bcol = col/bs; \
170 ridx = row % bs; cidx = col % bs; \
171 low = 0; high = nrow; \
172 while (high-low > 3) { \
173 t = (low+high)/2; \
174 if (rp[t] > bcol) high = t; \
175 else low = t; \
176 } \
177 for (_i=low; _i<high; _i++) { \
178 if (rp[_i] > bcol) break; \
179 if (rp[_i] == bcol) { \
180 bap = ap + bs2*_i + bs*cidx + ridx; \
181 if (addv == ADD_VALUES) *bap += value; \
182 else *bap = value; \
183 goto b_noinsert; \
184 } \
185 } \
186 if (b->nonew == 1) goto b_noinsert; \
187 if (b->nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at global row/column (%D, %D) into matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),187,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,orow,ocol)
; \
188 MatSeqXAIJReallocateAIJ(B,b->mbs,bs2,nrow,brow,bcol,rmax,ba,bi,bj,rp,ap,bimax,b->nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)B->data
; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (b->nonew == -
2) return PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),188,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs
+1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(bj))) || PetscMemcpy(new_j,bj,(bi[brow]+nrow)*
sizeof(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- bi[brow] - nrow); ierr = ((sizeof(*(new_j+bi[brow]+nrow+CHUNKSIZE
)) != sizeof(*(bj+bi[brow]+nrow))) || PetscMemcpy(new_j+bi[brow
]+nrow+CHUNKSIZE,bj+bi[brow]+nrow,(len)*sizeof(*(new_j+bi[brow
]+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(ba))) || PetscMemcpy(new_a,ba,(bs2*(bi[brow
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(bi[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(bi[brow]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(bi[brow]+nrow+CHUNKSIZE))) != sizeof(*(ba+bs2*(bi[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(bi[brow]+nrow+CHUNKSIZE
),ba+bs2*(bi[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(bi[brow
]+nrow+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),188,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain->
a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow
]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }
; \
189 N = nrow++ - 1; \
190 /* shift up all the later entries in this row */ \
191 ierr = PetscArraymove(rp+_i+1,rp+_i,N-_i+1)((sizeof(*(rp+_i+1)) != sizeof(*(rp+_i))) || PetscMemmove(rp+
_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i+1))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),191,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
192 ierr = PetscArraymove(ap+bs2*(_i+1),ap+bs2*_i,bs2*(N-_i+1))((sizeof(*(ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove
(ap+bs2*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1
)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),192,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
193 ierr = PetscArrayzero(ap+bs2*_i,bs2)PetscMemzero(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),193,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; \
194 rp[_i] = bcol; \
195 ap[bs2*_i + bs*cidx + ridx] = value; \
196 B->nonzerostate++;\
197b_noinsert:; \
198 bilen[brow] = nrow; \
199 }
200
201/* Only add/insert a(i,j) with i<=j (blocks).
202 Any a(i,j) with i>j input by user is ingored.
203*/
204PetscErrorCode MatSetValues_MPISBAIJ(Mat mat,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode addv)
205{
206 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
207 MatScalar value;
208 PetscBool roworiented = baij->roworiented;
209 PetscErrorCode ierr;
210 PetscInt i,j,row,col;
211 PetscInt rstart_orig=mat->rmap->rstart;
212 PetscInt rend_orig =mat->rmap->rend,cstart_orig=mat->cmap->rstart;
213 PetscInt cend_orig =mat->cmap->rend,bs=mat->rmap->bs;
214
215 /* Some Variables required in the macro */
216 Mat A = baij->A;
217 Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)(A)->data;
218 PetscInt *aimax=a->imax,*ai=a->i,*ailen=a->ilen,*aj=a->j;
219 MatScalar *aa =a->a;
220
221 Mat B = baij->B;
222 Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)(B)->data;
223 PetscInt *bimax=b->imax,*bi=b->i,*bilen=b->ilen,*bj=b->j;
224 MatScalar *ba =b->a;
225
226 PetscInt *rp,ii,nrow,_i,rmax,N,brow,bcol;
227 PetscInt low,high,t,ridx,cidx,bs2=a->bs2;
228 MatScalar *ap,*bap;
229
230 /* for stash */
231 PetscInt n_loc, *in_loc = NULL((void*)0);
232 MatScalar *v_loc = NULL((void*)0);
233
234 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 234; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
235 if (!baij->donotstash) {
236 if (n > baij->n_loc) {
237 ierr = PetscFree(baij->in_loc)((*PetscTrFree)((void*)(baij->in_loc),237,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->in_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 ierr = PetscFree(baij->v_loc)((*PetscTrFree)((void*)(baij->v_loc),238,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->v_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),238,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
239 ierr = PetscMalloc1(n,&baij->in_loc)PetscMallocA(1,PETSC_FALSE,239,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(n)*sizeof(**(&baij->in_loc)),(&baij->
in_loc))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),239,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
240 ierr = PetscMalloc1(n,&baij->v_loc)PetscMallocA(1,PETSC_FALSE,240,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(n)*sizeof(**(&baij->v_loc)),(&baij->v_loc
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),240,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
241
242 baij->n_loc = n;
243 }
244 in_loc = baij->in_loc;
245 v_loc = baij->v_loc;
246 }
247
248 for (i=0; i<m; i++) {
249 if (im[i] < 0) continue;
250#if defined(PETSC_USE_DEBUG1)
251 if (im[i] >= mat->rmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",im[i],mat->rmap->N-1)return PetscError(((MPI_Comm)0x44000001),251,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Row too large: row %D max %D",im[i],
mat->rmap->N-1)
;
252#endif
253 if (im[i] >= rstart_orig && im[i] < rend_orig) { /* this processor entry */
254 row = im[i] - rstart_orig; /* local row index */
255 for (j=0; j<n; j++) {
256 if (im[i]/bs > in[j]/bs) {
257 if (a->ignore_ltriangular) {
258 continue; /* ignore lower triangular blocks */
259 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),259,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)"
)
;
260 }
261 if (in[j] >= cstart_orig && in[j] < cend_orig) { /* diag entry (A) */
262 col = in[j] - cstart_orig; /* local col index */
263 brow = row/bs; bcol = col/bs;
264 if (brow > bcol) continue; /* ignore lower triangular blocks of A */
265 if (roworiented) value = v[i*n+j];
266 else value = v[i+j*m];
267 MatSetValues_SeqSBAIJ_A_Private(row,col,value,addv,im[i],in[j]){ brow = row/bs; rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; rmax
= aimax[brow]; nrow = ailen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
a_noinsert; } } if (a->nonew == 1) goto a_noinsert; if (a
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),267
,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,im[i],in[j]); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)A->data; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (a->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[brow]+nrow)*
sizeof(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[brow] - nrow); ierr = ((sizeof(*(new_j+ai[brow]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[brow]+nrow))) || PetscMemcpy(new_j+ai[brow
]+nrow+CHUNKSIZE,aj+ai[brow]+nrow,(len)*sizeof(*(new_j+ai[brow
]+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[brow
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(ai[brow]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[brow]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[brow]+nrow+CHUNKSIZE
),aa+bs2*(ai[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[brow
]+nrow+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow
]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));do
{if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),267,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),267,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; A->nonzerostate++;a_noinsert
:; ailen[brow] = nrow; }
;
268 /* ierr = MatSetValues_SeqBAIJ(baij->A,1,&row,1,&col,&value,addv);CHKERRQ(ierr); */
269 } else if (in[j] < 0) continue;
270#if defined(PETSC_USE_DEBUG1)
271 else if (in[j] >= mat->cmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[j],mat->cmap->N-1)return PetscError(((MPI_Comm)0x44000001),271,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Column too large: col %D max %D",in[
j],mat->cmap->N-1)
;
272#endif
273 else { /* off-diag entry (B) */
274 if (mat->was_assembled) {
275 if (!baij->colmap) {
276 ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),276,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
277 }
278#if defined(PETSC_USE_CTABLE1)
279 ierr = PetscTableFind(baij->colmap,in[j]/bs + 1,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),279,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
280 col = col - 1;
281#else
282 col = baij->colmap[in[j]/bs] - 1;
283#endif
284 if (col < 0 && !((Mat_SeqSBAIJ*)(baij->A->data))->nonew) {
285 ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),285,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
286 col = in[j];
287 /* Reinitialize the variables required by MatSetValues_SeqBAIJ_B_Private() */
288 B = baij->B;
289 b = (Mat_SeqBAIJ*)(B)->data;
290 bimax= b->imax;bi=b->i;bilen=b->ilen;bj=b->j;
291 ba = b->a;
292 } else col += in[j]%bs;
293 } else col = in[j];
294 if (roworiented) value = v[i*n+j];
295 else value = v[i+j*m];
296 MatSetValues_SeqSBAIJ_B_Private(row,col,value,addv,im[i],in[j]){ brow = row/bs; rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; rmax
= bimax[brow]; nrow = bilen[brow]; bcol = col/bs; ridx = row
% bs; cidx = col % bs; low = 0; high = nrow; while (high-low
> 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else
low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol
) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx
; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto
b_noinsert; } } if (b->nonew == 1) goto b_noinsert; if (b
->nonew == -1) return PetscError(((MPI_Comm)0x44000001),296
,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix"
,im[i],in[j]); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ
*)B->data; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] +
CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (b->
nonew == -2) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow
+1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs
+1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(bj))) || PetscMemcpy(new_j,bj,(bi[brow]+nrow)*
sizeof(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- bi[brow] - nrow); ierr = ((sizeof(*(new_j+bi[brow]+nrow+CHUNKSIZE
)) != sizeof(*(bj+bi[brow]+nrow))) || PetscMemcpy(new_j+bi[brow
]+nrow+CHUNKSIZE,bj+bi[brow]+nrow,(len)*sizeof(*(new_j+bi[brow
]+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(ba))) || PetscMemcpy(new_a,ba,(bs2*(bi[brow
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(bi[brow]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2
*(bi[brow]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(bi[brow]+nrow+CHUNKSIZE))) != sizeof(*(ba+bs2*(bi[
brow]+nrow)))) || PetscMemcpy(new_a+bs2*(bi[brow]+nrow+CHUNKSIZE
),ba+bs2*(bi[brow]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(bi[brow
]+nrow+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain->
a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow
]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] +
CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++
; }; N = nrow++ - 1; ierr = ((sizeof(*(rp+_i+1)) != sizeof(*(
rp+_i))) || PetscMemmove(rp+_i+1,rp+_i,(N-_i+1)*sizeof(*(rp+_i
+1))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
ap+bs2*(_i+1))) != sizeof(*(ap+bs2*_i))) || PetscMemmove(ap+bs2
*(_i+1),ap+bs2*_i,(bs2*(N-_i+1))*sizeof(*(ap+bs2*(_i+1)))));do
{if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(ap+bs2*_i,(bs2)*sizeof(*(ap+bs2*_i)));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); rp[_i] = bcol; ap[
bs2*_i + bs*cidx + ridx] = value; B->nonzerostate++;b_noinsert
:; bilen[brow] = nrow; }
;
297 /* ierr = MatSetValues_SeqBAIJ(baij->B,1,&row,1,&col,&value,addv);CHKERRQ(ierr); */
298 }
299 }
300 } else { /* off processor entry */
301 if (mat->nooffprocentries) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Setting off process row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set",im[i])return PetscError(((MPI_Comm)0x44000001),301,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Setting off process row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set"
,im[i])
;
302 if (!baij->donotstash) {
303 mat->assembled = PETSC_FALSE;
304 n_loc = 0;
305 for (j=0; j<n; j++) {
306 if (im[i]/bs > in[j]/bs) continue; /* ignore lower triangular blocks */
307 in_loc[n_loc] = in[j];
308 if (roworiented) {
309 v_loc[n_loc] = v[i*n+j];
310 } else {
311 v_loc[n_loc] = v[j*m+i];
312 }
313 n_loc++;
314 }
315 ierr = MatStashValuesRow_Private(&mat->stash,im[i],n_loc,in_loc,v_loc,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),315,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
316 }
317 }
318 }
319 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
320}
321
322PETSC_STATIC_INLINEstatic inline PetscErrorCode MatSetValuesBlocked_SeqSBAIJ_Inlined(Mat A,PetscInt row,PetscInt col,const PetscScalar v[],InsertMode is,PetscInt orow,PetscInt ocol)
323{
324 Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)A->data;
325 PetscErrorCode ierr;
326 PetscInt *rp,low,high,t,ii,jj,nrow,i,rmax,N;
327 PetscInt *imax =a->imax,*ai=a->i,*ailen=a->ilen;
328 PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs;
329 PetscBool roworiented=a->roworiented;
330 const PetscScalar *value = v;
331 MatScalar *ap,*aa = a->a,*bap;
332
333 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 333; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
334 if (col < row) {
335 if (a->ignore_ltriangular) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
; /* ignore lower triangular block */
336 else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),336,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)"
)
;
337 }
338 rp = aj + ai[row];
339 ap = aa + bs2*ai[row];
340 rmax = imax[row];
341 nrow = ailen[row];
342 value = v;
343 low = 0;
344 high = nrow;
345
346 while (high-low > 7) {
347 t = (low+high)/2;
348 if (rp[t] > col) high = t;
349 else low = t;
350 }
351 for (i=low; i<high; i++) {
352 if (rp[i] > col) break;
353 if (rp[i] == col) {
354 bap = ap + bs2*i;
355 if (roworiented) {
356 if (is == ADD_VALUES) {
357 for (ii=0; ii<bs; ii++) {
358 for (jj=ii; jj<bs2; jj+=bs) {
359 bap[jj] += *value++;
360 }
361 }
362 } else {
363 for (ii=0; ii<bs; ii++) {
364 for (jj=ii; jj<bs2; jj+=bs) {
365 bap[jj] = *value++;
366 }
367 }
368 }
369 } else {
370 if (is == ADD_VALUES) {
371 for (ii=0; ii<bs; ii++) {
372 for (jj=0; jj<bs; jj++) {
373 *bap++ += *value++;
374 }
375 }
376 } else {
377 for (ii=0; ii<bs; ii++) {
378 for (jj=0; jj<bs; jj++) {
379 *bap++ = *value++;
380 }
381 }
382 }
383 }
384 goto noinsert2;
385 }
386 }
387 if (nonew == 1) goto noinsert2;
388 if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new block index nonzero block (%D, %D) in the matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),388,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new block index nonzero block (%D, %D) in the matrix"
,orow,ocol)
;
389 MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return
PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,row,col); ierr = PetscMallocA(3,PETSC_FALSE,389,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),389,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row
+1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof
(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row
]+nrow+CHUNKSIZE,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]
+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[row
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[row]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2*
(ai[row]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[row]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[row
]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[row]+nrow+CHUNKSIZE),
aa+bs2*(ai[row]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[row]+nrow
+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),389,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),389,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row
]; ap = aa + bs2*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE
; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }
;
390 N = nrow++ - 1; high++;
391 /* shift up all the later entries in this row */
392 ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+
1,rp+i,(N-i+1)*sizeof(*(rp+i+1))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),392,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
393 ierr = PetscArraymove(ap+bs2*(i+1),ap+bs2*i,bs2*(N-i+1))((sizeof(*(ap+bs2*(i+1))) != sizeof(*(ap+bs2*i))) || PetscMemmove
(ap+bs2*(i+1),ap+bs2*i,(bs2*(N-i+1))*sizeof(*(ap+bs2*(i+1))))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),393,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
394 rp[i] = col;
395 bap = ap + bs2*i;
396 if (roworiented) {
397 for (ii=0; ii<bs; ii++) {
398 for (jj=ii; jj<bs2; jj+=bs) {
399 bap[jj] = *value++;
400 }
401 }
402 } else {
403 for (ii=0; ii<bs; ii++) {
404 for (jj=0; jj<bs; jj++) {
405 *bap++ = *value++;
406 }
407 }
408 }
409 noinsert2:;
410 ailen[row] = nrow;
411 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
412}
413
414/*
415 This routine is exactly duplicated in mpibaij.c
416*/
417PETSC_STATIC_INLINEstatic inline PetscErrorCode MatSetValuesBlocked_SeqBAIJ_Inlined(Mat A,PetscInt row,PetscInt col,const PetscScalar v[],InsertMode is,PetscInt orow,PetscInt ocol)
418{
419 Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data;
420 PetscInt *rp,low,high,t,ii,jj,nrow,i,rmax,N;
421 PetscInt *imax=a->imax,*ai=a->i,*ailen=a->ilen;
422 PetscErrorCode ierr;
423 PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs;
424 PetscBool roworiented=a->roworiented;
425 const PetscScalar *value = v;
426 MatScalar *ap,*aa = a->a,*bap;
427
428 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 428; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
429 rp = aj + ai[row];
430 ap = aa + bs2*ai[row];
431 rmax = imax[row];
432 nrow = ailen[row];
433 low = 0;
434 high = nrow;
435 value = v;
436 while (high-low > 7) {
437 t = (low+high)/2;
438 if (rp[t] > col) high = t;
439 else low = t;
440 }
441 for (i=low; i<high; i++) {
442 if (rp[i] > col) break;
443 if (rp[i] == col) {
444 bap = ap + bs2*i;
445 if (roworiented) {
446 if (is == ADD_VALUES) {
447 for (ii=0; ii<bs; ii++) {
448 for (jj=ii; jj<bs2; jj+=bs) {
449 bap[jj] += *value++;
450 }
451 }
452 } else {
453 for (ii=0; ii<bs; ii++) {
454 for (jj=ii; jj<bs2; jj+=bs) {
455 bap[jj] = *value++;
456 }
457 }
458 }
459 } else {
460 if (is == ADD_VALUES) {
461 for (ii=0; ii<bs; ii++,value+=bs) {
462 for (jj=0; jj<bs; jj++) {
463 bap[jj] += value[jj];
464 }
465 bap += bs;
466 }
467 } else {
468 for (ii=0; ii<bs; ii++,value+=bs) {
469 for (jj=0; jj<bs; jj++) {
470 bap[jj] = value[jj];
471 }
472 bap += bs;
473 }
474 }
475 }
476 goto noinsert2;
477 }
478 }
479 if (nonew == 1) goto noinsert2;
480 if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new global block indexed nonzero block (%D, %D) in the matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),480,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Inserting a new global block indexed nonzero block (%D, %D) in the matrix"
,orow,ocol)
;
481 MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data
; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,
len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return
PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
,row,col); ierr = PetscMallocA(3,PETSC_FALSE,481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t
)(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a->
mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),481,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row
+1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs
+1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = ((sizeof(*(new_j
)) != sizeof(*(aj))) || PetscMemcpy(new_j,aj,(ai[row]+nrow)*sizeof
(*(new_j))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE
- ai[row] - nrow); ierr = ((sizeof(*(new_j+ai[row]+nrow+CHUNKSIZE
)) != sizeof(*(aj+ai[row]+nrow))) || PetscMemcpy(new_j+ai[row
]+nrow+CHUNKSIZE,aj+ai[row]+nrow,(len)*sizeof(*(new_j+ai[row]
+nrow+CHUNKSIZE))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a)) != sizeof(*(aa))) || PetscMemcpy(new_a,aa,(bs2*(ai[row
]+nrow))*sizeof(*(new_a))));do {if (__builtin_expect(!!(ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero
(new_a+bs2*(ai[row]+nrow),(bs2*CHUNKSIZE)*sizeof(*(new_a+bs2*
(ai[row]+nrow))));do {if (__builtin_expect(!!(ierr),0)) return
PetscError(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = ((sizeof(*(
new_a+bs2*(ai[row]+nrow+CHUNKSIZE))) != sizeof(*(aa+bs2*(ai[row
]+nrow)))) || PetscMemcpy(new_a+bs2*(ai[row]+nrow+CHUNKSIZE),
aa+bs2*(ai[row]+nrow),(bs2*len)*sizeof(*(new_a+bs2*(ai[row]+nrow
+CHUNKSIZE)))));do {if (__builtin_expect(!!(ierr),0)) return PetscError
(((MPI_Comm)0x44000001),481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ
(A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect
(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),481,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain->
a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain->
j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row
]; ap = aa + bs2*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE
; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }
;
482 N = nrow++ - 1; high++;
483 /* shift up all the later entries in this row */
484 ierr = PetscArraymove(rp+i+1,rp+i,N-i+1)((sizeof(*(rp+i+1)) != sizeof(*(rp+i))) || PetscMemmove(rp+i+
1,rp+i,(N-i+1)*sizeof(*(rp+i+1))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),484,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
485 ierr = PetscArraymove(ap+bs2*(i+1),ap+bs2*i,bs2*(N-i+1))((sizeof(*(ap+bs2*(i+1))) != sizeof(*(ap+bs2*i))) || PetscMemmove
(ap+bs2*(i+1),ap+bs2*i,(bs2*(N-i+1))*sizeof(*(ap+bs2*(i+1))))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),485,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
486 rp[i] = col;
487 bap = ap + bs2*i;
488 if (roworiented) {
489 for (ii=0; ii<bs; ii++) {
490 for (jj=ii; jj<bs2; jj+=bs) {
491 bap[jj] = *value++;
492 }
493 }
494 } else {
495 for (ii=0; ii<bs; ii++) {
496 for (jj=0; jj<bs; jj++) {
497 *bap++ = *value++;
498 }
499 }
500 }
501 noinsert2:;
502 ailen[row] = nrow;
503 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
504}
505
506/*
507 This routine could be optimized by removing the need for the block copy below and passing stride information
508 to the above inline routines; similarly in MatSetValuesBlocked_MPIBAIJ()
509*/
510PetscErrorCode MatSetValuesBlocked_MPISBAIJ(Mat mat,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const MatScalar v[],InsertMode addv)
511{
512 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
513 const MatScalar *value;
514 MatScalar *barray =baij->barray;
515 PetscBool roworiented = baij->roworiented,ignore_ltriangular = ((Mat_SeqSBAIJ*)baij->A->data)->ignore_ltriangular;
516 PetscErrorCode ierr;
517 PetscInt i,j,ii,jj,row,col,rstart=baij->rstartbs;
518 PetscInt rend=baij->rendbs,cstart=baij->rstartbs,stepval;
519 PetscInt cend=baij->rendbs,bs=mat->rmap->bs,bs2=baij->bs2;
520
521 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 521; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
522 if (!barray) {
523 ierr = PetscMalloc1(bs2,&barray)PetscMallocA(1,PETSC_FALSE,523,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs2)*sizeof(**(&barray)),(&barray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),523,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
524 baij->barray = barray;
525 }
526
527 if (roworiented) {
528 stepval = (n-1)*bs;
529 } else {
530 stepval = (m-1)*bs;
531 }
532 for (i=0; i<m; i++) {
533 if (im[i] < 0) continue;
534#if defined(PETSC_USE_DEBUG1)
535 if (im[i] >= baij->Mbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block indexed row too large %D max %D",im[i],baij->Mbs-1)return PetscError(((MPI_Comm)0x44000001),535,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Block indexed row too large %D max %D"
,im[i],baij->Mbs-1)
;
536#endif
537 if (im[i] >= rstart && im[i] < rend) {
538 row = im[i] - rstart;
539 for (j=0; j<n; j++) {
540 if (im[i] > in[j]) {
541 if (ignore_ltriangular) continue; /* ignore lower triangular blocks */
542 else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),542,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)"
)
;
543 }
544 /* If NumCol = 1 then a copy is not required */
545 if ((roworiented) && (n == 1)) {
546 barray = (MatScalar*) v + i*bs2;
547 } else if ((!roworiented) && (m == 1)) {
548 barray = (MatScalar*) v + j*bs2;
549 } else { /* Here a copy is required */
550 if (roworiented) {
551 value = v + i*(stepval+bs)*bs + j*bs;
552 } else {
553 value = v + j*(stepval+bs)*bs + i*bs;
554 }
555 for (ii=0; ii<bs; ii++,value+=stepval) {
556 for (jj=0; jj<bs; jj++) {
557 *barray++ = *value++;
558 }
559 }
560 barray -=bs2;
561 }
562
563 if (in[j] >= cstart && in[j] < cend) {
564 col = in[j] - cstart;
565 ierr = MatSetValuesBlocked_SeqSBAIJ_Inlined(baij->A,row,col,barray,addv,im[i],in[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),565,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
566 } else if (in[j] < 0) continue;
567#if defined(PETSC_USE_DEBUG1)
568 else if (in[j] >= baij->Nbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block indexed column too large %D max %D",in[j],baij->Nbs-1)return PetscError(((MPI_Comm)0x44000001),568,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Block indexed column too large %D max %D"
,in[j],baij->Nbs-1)
;
569#endif
570 else {
571 if (mat->was_assembled) {
572 if (!baij->colmap) {
573 ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),573,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
574 }
575
576#if defined(PETSC_USE_DEBUG1)
577#if defined(PETSC_USE_CTABLE1)
578 { PetscInt data;
579 ierr = PetscTableFind(baij->colmap,in[j]+1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),579,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
580 if ((data - 1) % bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Incorrect colmap")return PetscError(((MPI_Comm)0x44000001),580,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,77,PETSC_ERROR_INITIAL,"Incorrect colmap")
;
581 }
582#else
583 if ((baij->colmap[in[j]] - 1) % bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Incorrect colmap")return PetscError(((MPI_Comm)0x44000001),583,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,77,PETSC_ERROR_INITIAL,"Incorrect colmap")
;
584#endif
585#endif
586#if defined(PETSC_USE_CTABLE1)
587 ierr = PetscTableFind(baij->colmap,in[j]+1,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),587,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
588 col = (col - 1)/bs;
589#else
590 col = (baij->colmap[in[j]] - 1)/bs;
591#endif
592 if (col < 0 && !((Mat_SeqBAIJ*)(baij->A->data))->nonew) {
593 ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),593,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
594 col = in[j];
595 }
596 } else col = in[j];
597 ierr = MatSetValuesBlocked_SeqBAIJ_Inlined(baij->B,row,col,barray,addv,im[i],in[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),597,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
598 }
599 }
600 } else {
601 if (mat->nooffprocentries) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Setting off process block indexed row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set",im[i])return PetscError(((MPI_Comm)0x44000001),601,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Setting off process block indexed row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set"
,im[i])
;
602 if (!baij->donotstash) {
603 if (roworiented) {
604 ierr = MatStashValuesRowBlocked_Private(&mat->bstash,im[i],n,in,v,m,n,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),604,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
605 } else {
606 ierr = MatStashValuesColBlocked_Private(&mat->bstash,im[i],n,in,v,m,n,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),606,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
607 }
608 }
609 }
610 }
611 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
612}
613
614PetscErrorCode MatGetValues_MPISBAIJ(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],PetscScalar v[])
615{
616 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
617 PetscErrorCode ierr;
618 PetscInt bs = mat->rmap->bs,i,j,bsrstart = mat->rmap->rstart,bsrend = mat->rmap->rend;
619 PetscInt bscstart = mat->cmap->rstart,bscend = mat->cmap->rend,row,col,data;
620
621 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 621; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
622 for (i=0; i<m; i++) {
1
Assuming 'i' is < 'm'
2
Loop condition is true. Entering loop body
16
Assuming 'i' is < 'm'
17
Loop condition is true. Entering loop body
623 if (idxm[i] < 0) continue; /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row: %D",idxm[i]); */
3
Assuming the condition is false
4
Taking false branch
18
Assuming the condition is false
19
Taking false branch
624 if (idxm[i] >= mat->rmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",idxm[i],mat->rmap->N-1)return PetscError(((MPI_Comm)0x44000001),624,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Row too large: row %D max %D",idxm[i
],mat->rmap->N-1)
;
5
Taking false branch
20
Taking false branch
625 if (idxm[i] >= bsrstart && idxm[i] < bsrend) {
6
Taking true branch
21
Taking true branch
626 row = idxm[i] - bsrstart;
627 for (j=0; j<n; j++) {
7
Assuming 'j' is < 'n'
8
Loop condition is true. Entering loop body
14
Assuming 'j' is >= 'n'
15
Loop condition is false. Execution continues on line 622
22
Loop condition is true. Entering loop body
628 if (idxn[j] < 0) continue; /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column %D",idxn[j]); */
9
Assuming the condition is false
10
Taking false branch
23
Taking false branch
629 if (idxn[j] >= mat->cmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",idxn[j],mat->cmap->N-1)return PetscError(((MPI_Comm)0x44000001),629,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Column too large: col %D max %D",idxn
[j],mat->cmap->N-1)
;
11
Taking false branch
24
Taking false branch
630 if (idxn[j] >= bscstart && idxn[j] < bscend) {
631 col = idxn[j] - bscstart;
632 ierr = MatGetValues_SeqSBAIJ(baij->A,1,&row,1,&col,v+i*n+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),632,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
633 } else {
634 if (!baij->colmap) {
12
Assuming the condition is false
13
Taking false branch
25
Taking false branch
635 ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),635,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
636 }
637#if defined(PETSC_USE_CTABLE1)
638 ierr = PetscTableFind(baij->colmap,idxn[j]/bs+1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),638,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
26
Calling 'PetscTableFind'
639 data--;
640#else
641 data = baij->colmap[idxn[j]/bs]-1;
642#endif
643 if ((data < 0) || (baij->garray[data/bs] != idxn[j]/bs)) *(v+i*n+j) = 0.0;
644 else {
645 col = data + idxn[j]%bs;
646 ierr = MatGetValues_SeqBAIJ(baij->B,1,&row,1,&col,v+i*n+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),646,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
647 }
648 }
649 }
650 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only local values currently supported")return PetscError(((MPI_Comm)0x44000001),650,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only local values currently supported"
)
;
651 }
652 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
653}
654
655PetscErrorCode MatNorm_MPISBAIJ(Mat mat,NormType type,PetscReal *norm)
656{
657 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
658 PetscErrorCode ierr;
659 PetscReal sum[2],*lnorm2;
660
661 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 661; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
662 if (baij->size == 1) {
663 ierr = MatNorm(baij->A,type,norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),663,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
664 } else {
665 if (type == NORM_FROBENIUS) {
666 ierr = PetscMalloc1(2,&lnorm2)PetscMallocA(1,PETSC_FALSE,666,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(2)*sizeof(**(&lnorm2)),(&lnorm2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),666,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
667 ierr = MatNorm(baij->A,type,lnorm2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),667,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
668 *lnorm2 = (*lnorm2)*(*lnorm2); lnorm2++; /* squar power of norm(A) */
669 ierr = MatNorm(baij->B,type,lnorm2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),669,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
670 *lnorm2 = (*lnorm2)*(*lnorm2); lnorm2--; /* squar power of norm(B) */
671 ierr = MPIU_Allreduce(lnorm2,sum,2,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,2,671,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((lnorm2),(sum),(2),(
((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003)),(PetscObjectComm
((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),671,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
672 *norm = PetscSqrtReal(sum[0] + 2*sum[1])sqrt(sum[0] + 2*sum[1]);
673 ierr = PetscFree(lnorm2)((*PetscTrFree)((void*)(lnorm2),673,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((lnorm2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),673,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
674 } else if (type == NORM_INFINITY || type == NORM_1) { /* max row/column sum */
675 Mat_SeqSBAIJ *amat=(Mat_SeqSBAIJ*)baij->A->data;
676 Mat_SeqBAIJ *bmat=(Mat_SeqBAIJ*)baij->B->data;
677 PetscReal *rsum,*rsum2,vabs;
678 PetscInt *jj,*garray=baij->garray,rstart=baij->rstartbs,nz;
679 PetscInt brow,bcol,col,bs=baij->A->rmap->bs,row,grow,gcol,mbs=amat->mbs;
680 MatScalar *v;
681
682 ierr = PetscMalloc2(mat->cmap->N,&rsum,mat->cmap->N,&rsum2)PetscMallocA(2,PETSC_FALSE,682,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(mat->cmap->N)*sizeof(**(&rsum)),(&rsum
),(size_t)(mat->cmap->N)*sizeof(**(&rsum2)),(&rsum2
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),682,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
683 ierr = PetscArrayzero(rsum,mat->cmap->N)PetscMemzero(rsum,(mat->cmap->N)*sizeof(*(rsum)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),683,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
684 /* Amat */
685 v = amat->a; jj = amat->j;
686 for (brow=0; brow<mbs; brow++) {
687 grow = bs*(rstart + brow);
688 nz = amat->i[brow+1] - amat->i[brow];
689 for (bcol=0; bcol<nz; bcol++) {
690 gcol = bs*(rstart + *jj); jj++;
691 for (col=0; col<bs; col++) {
692 for (row=0; row<bs; row++) {
693 vabs = PetscAbsScalar(*v); v++;
694 rsum[gcol+col] += vabs;
695 /* non-diagonal block */
696 if (bcol > 0 && vabs > 0.0) rsum[grow+row] += vabs;
697 }
698 }
699 }
700 ierr = PetscLogFlops(nz*bs*bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),700,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
701 }
702 /* Bmat */
703 v = bmat->a; jj = bmat->j;
704 for (brow=0; brow<mbs; brow++) {
705 grow = bs*(rstart + brow);
706 nz = bmat->i[brow+1] - bmat->i[brow];
707 for (bcol=0; bcol<nz; bcol++) {
708 gcol = bs*garray[*jj]; jj++;
709 for (col=0; col<bs; col++) {
710 for (row=0; row<bs; row++) {
711 vabs = PetscAbsScalar(*v); v++;
712 rsum[gcol+col] += vabs;
713 rsum[grow+row] += vabs;
714 }
715 }
716 }
717 ierr = PetscLogFlops(nz*bs*bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),717,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
718 }
719 ierr = MPIU_Allreduce(rsum,rsum2,mat->cmap->N,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,mat->cmap->N,719,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((rsum),(rsum2),(mat->
cmap->N),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003
)),(PetscObjectComm((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),719,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
720 *norm = 0.0;
721 for (col=0; col<mat->cmap->N; col++) {
722 if (rsum2[col] > *norm) *norm = rsum2[col];
723 }
724 ierr = PetscFree2(rsum,rsum2)PetscFreeA(2,724,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(rsum),&(rsum2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),724,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
725 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for this norm yet")return PetscError(((MPI_Comm)0x44000001),725,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"No support for this norm yet")
;
726 }
727 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
728}
729
730PetscErrorCode MatAssemblyBegin_MPISBAIJ(Mat mat,MatAssemblyType mode)
731{
732 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
733 PetscErrorCode ierr;
734 PetscInt nstash,reallocs;
735
736 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 736; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
737 if (baij->donotstash || mat->nooffprocentries) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
738
739 ierr = MatStashScatterBegin_Private(mat,&mat->stash,mat->rmap->range);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),739,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
740 ierr = MatStashScatterBegin_Private(mat,&mat->bstash,baij->rangebs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),740,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
741 ierr = MatStashGetInfo_Private(&mat->stash,&nstash,&reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),741,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
742 ierr = PetscInfo2(mat,"Stash has %D entries,uses %D mallocs.\n",nstash,reallocs)PetscInfo_Private(__func__,mat,"Stash has %D entries,uses %D mallocs.\n"
,nstash,reallocs)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),742,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
743 ierr = MatStashGetInfo_Private(&mat->stash,&nstash,&reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),743,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
744 ierr = PetscInfo2(mat,"Block-Stash has %D entries, uses %D mallocs.\n",nstash,reallocs)PetscInfo_Private(__func__,mat,"Block-Stash has %D entries, uses %D mallocs.\n"
,nstash,reallocs)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),744,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
745 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
746}
747
748PetscErrorCode MatAssemblyEnd_MPISBAIJ(Mat mat,MatAssemblyType mode)
749{
750 Mat_MPISBAIJ *baij=(Mat_MPISBAIJ*)mat->data;
751 Mat_SeqSBAIJ *a =(Mat_SeqSBAIJ*)baij->A->data;
752 PetscErrorCode ierr;
753 PetscInt i,j,rstart,ncols,flg,bs2=baij->bs2;
754 PetscInt *row,*col;
755 PetscBool other_disassembled;
756 PetscMPIInt n;
757 PetscBool r1,r2,r3;
758 MatScalar *val;
759
760 /* do not use 'b=(Mat_SeqBAIJ*)baij->B->data' as B can be reset in disassembly */
761 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 761; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
762 if (!baij->donotstash && !mat->nooffprocentries) {
763 while (1) {
764 ierr = MatStashScatterGetMesg_Private(&mat->stash,&n,&row,&col,&val,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),764,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
765 if (!flg) break;
766
767 for (i=0; i<n;) {
768 /* Now identify the consecutive vals belonging to the same row */
769 for (j=i,rstart=row[j]; j<n; j++) {
770 if (row[j] != rstart) break;
771 }
772 if (j < n) ncols = j-i;
773 else ncols = n-i;
774 /* Now assemble all these values with a single function call */
775 ierr = MatSetValues_MPISBAIJ(mat,1,row+i,ncols,col+i,val+i,mat->insertmode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),775,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
776 i = j;
777 }
778 }
779 ierr = MatStashScatterEnd_Private(&mat->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),779,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
780 /* Now process the block-stash. Since the values are stashed column-oriented,
781 set the roworiented flag to column oriented, and after MatSetValues()
782 restore the original flags */
783 r1 = baij->roworiented;
784 r2 = a->roworiented;
785 r3 = ((Mat_SeqBAIJ*)baij->B->data)->roworiented;
786
787 baij->roworiented = PETSC_FALSE;
788 a->roworiented = PETSC_FALSE;
789
790 ((Mat_SeqBAIJ*)baij->B->data)->roworiented = PETSC_FALSE; /* b->roworinted */
791 while (1) {
792 ierr = MatStashScatterGetMesg_Private(&mat->bstash,&n,&row,&col,&val,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),792,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
793 if (!flg) break;
794
795 for (i=0; i<n;) {
796 /* Now identify the consecutive vals belonging to the same row */
797 for (j=i,rstart=row[j]; j<n; j++) {
798 if (row[j] != rstart) break;
799 }
800 if (j < n) ncols = j-i;
801 else ncols = n-i;
802 ierr = MatSetValuesBlocked_MPISBAIJ(mat,1,row+i,ncols,col+i,val+i*bs2,mat->insertmode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),802,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
803 i = j;
804 }
805 }
806 ierr = MatStashScatterEnd_Private(&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),806,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
807
808 baij->roworiented = r1;
809 a->roworiented = r2;
810
811 ((Mat_SeqBAIJ*)baij->B->data)->roworiented = r3; /* b->roworinted */
812 }
813
814 ierr = MatAssemblyBegin(baij->A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),814,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
815 ierr = MatAssemblyEnd(baij->A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),815,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
816
817 /* determine if any processor has disassembled, if so we must
818 also disassemble ourselfs, in order that we may reassemble. */
819 /*
820 if nonzero structure of submatrix B cannot change then we know that
821 no processor disassembled thus we can skip this stuff
822 */
823 if (!((Mat_SeqBAIJ*)baij->B->data)->nonew) {
824 ierr = MPIU_Allreduce(&mat->was_assembled,&other_disassembled,1,MPIU_BOOL,MPI_PROD,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,1,824,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((&mat->was_assembled
),(&other_disassembled),(1),(MPIU_BOOL),((MPI_Op)(0x58000004
)),(PetscObjectComm((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),824,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
825 if (mat->was_assembled && !other_disassembled) {
826 ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),826,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
827 }
828 }
829
830 if (!mat->was_assembled && mode == MAT_FINAL_ASSEMBLY) {
831 ierr = MatSetUpMultiply_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),831,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* setup Mvctx and sMvctx */
832 }
833 ierr = MatAssemblyBegin(baij->B,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),833,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
834 ierr = MatAssemblyEnd(baij->B,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),834,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
835
836 ierr = PetscFree2(baij->rowvalues,baij->rowindices)PetscFreeA(2,836,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(baij->rowvalues),&(baij->rowindices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),836,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
837
838 baij->rowvalues = 0;
839
840 /* if no new nonzero locations are allowed in matrix then only set the matrix state the first time through */
841 if ((!mat->was_assembled && mode == MAT_FINAL_ASSEMBLY) || !((Mat_SeqBAIJ*)(baij->A->data))->nonew) {
842 PetscObjectState state = baij->A->nonzerostate + baij->B->nonzerostate;
843 ierr = MPIU_Allreduce(&state,&mat->nonzerostate,1,MPIU_INT64,MPI_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,1,843,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((&state),(&mat
->nonzerostate),(1),(((MPI_Datatype)0x4c00083a)),((MPI_Op)
(0x58000003)),(PetscObjectComm((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),843,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
844 }
845 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
846}
847
848extern PetscErrorCode MatSetValues_MPIBAIJ(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode);
849#include <petscdraw.h>
850static PetscErrorCode MatView_MPISBAIJ_ASCIIorDraworSocket(Mat mat,PetscViewer viewer)
851{
852 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
853 PetscErrorCode ierr;
854 PetscInt bs = mat->rmap->bs;
855 PetscMPIInt rank = baij->rank;
856 PetscBool iascii,isdraw;
857 PetscViewer sviewer;
858 PetscViewerFormat format;
859
860 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 860; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
861 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),861,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
862 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),862,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
863 if (iascii) {
864 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),864,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
865 if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
866 MatInfo info;
867 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),867,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
868 ierr = MatGetInfo(mat,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),868,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
869 ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),869,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
870 ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] Local rows %D nz %D nz alloced %D bs %D mem %g\n",rank,mat->rmap->n,(PetscInt)info.nz_used,(PetscInt)info.nz_allocated,mat->rmap->bs,(double)info.memory);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),870,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
871 ierr = MatGetInfo(baij->A,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),871,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
872 ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] on-diagonal part: nz %D \n",rank,(PetscInt)info.nz_used);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),872,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
873 ierr = MatGetInfo(baij->B,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),873,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
874 ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] off-diagonal part: nz %D \n",rank,(PetscInt)info.nz_used);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),874,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
875 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),875,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
876 ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),876,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
877 ierr = PetscViewerASCIIPrintf(viewer,"Information on VecScatter used in matrix-vector product: \n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),877,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
878 ierr = VecScatterView(baij->Mvctx,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),878,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
879 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
880 } else if (format == PETSC_VIEWER_ASCII_INFO) {
881 ierr = PetscViewerASCIIPrintf(viewer," block size is %D\n",bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),881,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
882 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
883 } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO) {
884 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
885 }
886 }
887
888 if (isdraw) {
889 PetscDraw draw;
890 PetscBool isnull;
891 ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),891,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
892 ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),892,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
893 if (isnull) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
894 }
895
896 {
897 /* assemble the entire matrix onto first processor. */
898 Mat A;
899 Mat_SeqSBAIJ *Aloc;
900 Mat_SeqBAIJ *Bloc;
901 PetscInt M = mat->rmap->N,N = mat->cmap->N,*ai,*aj,col,i,j,k,*rvals,mbs = baij->mbs;
902 MatScalar *a;
903 const char *matname;
904
905 /* Should this be the same type as mat? */
906 ierr = MatCreate(PetscObjectComm((PetscObject)mat),&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),906,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
907 if (!rank) {
908 ierr = MatSetSizes(A,M,N,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),908,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
909 } else {
910 ierr = MatSetSizes(A,0,0,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),910,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
911 }
912 ierr = MatSetType(A,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),912,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
913 ierr = MatMPISBAIJSetPreallocation(A,mat->rmap->bs,0,NULL((void*)0),0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),913,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
914 ierr = MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),914,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
915 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),915,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
916
917 /* copy over the A part */
918 Aloc = (Mat_SeqSBAIJ*)baij->A->data;
919 ai = Aloc->i; aj = Aloc->j; a = Aloc->a;
920 ierr = PetscMalloc1(bs,&rvals)PetscMallocA(1,PETSC_FALSE,920,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(bs)*sizeof(**(&rvals)),(&rvals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),920,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
921
922 for (i=0; i<mbs; i++) {
923 rvals[0] = bs*(baij->rstartbs + i);
924 for (j=1; j<bs; j++) rvals[j] = rvals[j-1] + 1;
925 for (j=ai[i]; j<ai[i+1]; j++) {
926 col = (baij->cstartbs+aj[j])*bs;
927 for (k=0; k<bs; k++) {
928 ierr = MatSetValues_MPISBAIJ(A,bs,rvals,1,&col,a,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),928,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
929 col++;
930 a += bs;
931 }
932 }
933 }
934 /* copy over the B part */
935 Bloc = (Mat_SeqBAIJ*)baij->B->data;
936 ai = Bloc->i; aj = Bloc->j; a = Bloc->a;
937 for (i=0; i<mbs; i++) {
938
939 rvals[0] = bs*(baij->rstartbs + i);
940 for (j=1; j<bs; j++) rvals[j] = rvals[j-1] + 1;
941 for (j=ai[i]; j<ai[i+1]; j++) {
942 col = baij->garray[aj[j]]*bs;
943 for (k=0; k<bs; k++) {
944 ierr = MatSetValues_MPIBAIJ(A,bs,rvals,1,&col,a,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),944,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
945 col++;
946 a += bs;
947 }
948 }
949 }
950 ierr = PetscFree(rvals)((*PetscTrFree)((void*)(rvals),950,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((rvals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),950,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
951 ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),951,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
952 ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),952,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
953 /*
954 Everyone has to call to draw the matrix since the graphics waits are
955 synchronized across all processors that share the PetscDraw object
956 */
957 ierr = PetscViewerGetSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),957,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
958 ierr = PetscObjectGetName((PetscObject)mat,&matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),958,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
959 if (!rank) {
960 ierr = PetscObjectSetName((PetscObject)((Mat_MPISBAIJ*)(A->data))->A,matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),960,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
961 ierr = MatView_SeqSBAIJ(((Mat_MPISBAIJ*)(A->data))->A,sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),961,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
962 }
963 ierr = PetscViewerRestoreSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),963,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
964 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),964,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
965 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),965,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
966 }
967 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
968}
969
970static PetscErrorCode MatView_MPISBAIJ_Binary(Mat mat,PetscViewer viewer)
971{
972 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)mat->data;
973 Mat_SeqSBAIJ *A = (Mat_SeqSBAIJ*)a->A->data;
974 Mat_SeqBAIJ *B = (Mat_SeqBAIJ*)a->B->data;
975 PetscErrorCode ierr;
976 PetscInt i,*row_lens,*crow_lens,bs = mat->rmap->bs,j,k,bs2=a->bs2,header[4],nz,rlen;
977 PetscInt *range=0,nzmax,*column_indices,cnt,col,*garray = a->garray,cstart = mat->cmap->rstart/bs,len,pcnt,l,ll;
978 int fd;
979 PetscScalar *column_values;
980 FILE *file;
981 PetscMPIInt rank,size,tag = ((PetscObject)viewer)->tag;
982 PetscInt message_count,flowcontrolcount;
983
984 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 984; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
985 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),985,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
986 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)mat),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),986,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
987 nz = bs2*(A->nz + B->nz);
988 rlen = mat->rmap->n;
989 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),989,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
990 if (!rank) {
991 header[0] = MAT_FILE_CLASSID1211216;
992 header[1] = mat->rmap->N;
993 header[2] = mat->cmap->N;
994
995 ierr = MPI_Reduce(&nz,&header[3],1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),995,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
996 ierr = PetscBinaryWrite(fd,header,4,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),996,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
997 /* get largest number of rows any processor has */
998 range = mat->rmap->range;
999 for (i=1; i<size; i++) {
1000 rlen = PetscMax(rlen,range[i+1] - range[i])(((rlen)<(range[i+1] - range[i])) ? (range[i+1] - range[i]
) : (rlen))
;
1001 }
1002 } else {
1003 ierr = MPI_Reduce(&nz,0,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1003,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1004 }
1005
1006 ierr = PetscMalloc1(rlen/bs,&crow_lens)PetscMallocA(1,PETSC_FALSE,1006,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(rlen/bs)*sizeof(**(&crow_lens)),(&crow_lens
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1006,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1007 /* compute lengths of each row */
1008 for (i=0; i<a->mbs; i++) {
1009 crow_lens[i] = A->i[i+1] - A->i[i] + B->i[i+1] - B->i[i];
1010 }
1011 /* store the row lengths to the file */
1012 ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1012,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1013 if (!rank) {
1014 MPI_Status status;
1015 ierr = PetscMalloc1(rlen,&row_lens)PetscMallocA(1,PETSC_FALSE,1015,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(rlen)*sizeof(**(&row_lens)),(&row_lens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1015,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1016 rlen = (range[1] - range[0])/bs;
1017 for (i=0; i<rlen; i++) {
1018 for (j=0; j<bs; j++) {
1019 row_lens[i*bs+j] = bs*crow_lens[i];
1020 }
1021 }
1022 ierr = PetscBinaryWrite(fd,row_lens,bs*rlen,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1022,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1023 for (i=1; i<size; i++) {
1024 rlen = (range[i+1] - range[i])/bs;
1025 ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1025,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1026 ierr = MPI_Recv(crow_lens,rlen,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((rlen),(((MPI_Datatype
)0x4c000405)),(&petsc_recv_len)) || MPI_Recv((crow_lens),
(rlen),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm
((PetscObject)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1026,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1027 for (k=0; k<rlen; k++) {
1028 for (j=0; j<bs; j++) {
1029 row_lens[k*bs+j] = bs*crow_lens[k];
1030 }
1031 }
1032 ierr = PetscBinaryWrite(fd,row_lens,bs*rlen,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1033 }
1034 ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1034,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1035 ierr = PetscFree(row_lens)((*PetscTrFree)((void*)(row_lens),1035,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((row_lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1035,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1036 } else {
1037 ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1037,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1038 ierr = MPI_Send(crow_lens,mat->rmap->n/bs,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((mat->rmap->n/
bs),(((MPI_Datatype)0x4c000405)),(&petsc_send_len)) || MPI_Send
((crow_lens),(mat->rmap->n/bs),(((MPI_Datatype)0x4c000405
)),(0),(tag),(PetscObjectComm((PetscObject)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1038,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1039 ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1039,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1040 }
1041 ierr = PetscFree(crow_lens)((*PetscTrFree)((void*)(crow_lens),1041,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((crow_lens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1041,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1042
1043 /* load up the local column indices. Include for all rows not just one for each block row since process 0 does not have the
1044 information needed to make it for each row from a block row. This does require more communication but still not more than
1045 the communication needed for the nonzero values */
1046 nzmax = nz; /* space a largest processor needs */
1047 ierr = MPI_Reduce(&nz,&nzmax,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_MAX(MPI_Op)(0x58000001),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1047,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1048 ierr = PetscMalloc1(nzmax,&column_indices)PetscMallocA(1,PETSC_FALSE,1048,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(nzmax)*sizeof(**(&column_indices)),(&column_indices
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1048,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1049 cnt = 0;
1050 for (i=0; i<a->mbs; i++) {
1051 pcnt = cnt;
1052 for (j=B->i[i]; j<B->i[i+1]; j++) {
1053 if ((col = garray[B->j[j]]) > cstart) break;
1054 for (l=0; l<bs; l++) {
1055 column_indices[cnt++] = bs*col+l;
1056 }
1057 }
1058 for (k=A->i[i]; k<A->i[i+1]; k++) {
1059 for (l=0; l<bs; l++) {
1060 column_indices[cnt++] = bs*(A->j[k] + cstart)+l;
1061 }
1062 }
1063 for (; j<B->i[i+1]; j++) {
1064 for (l=0; l<bs; l++) {
1065 column_indices[cnt++] = bs*garray[B->j[j]]+l;
1066 }
1067 }
1068 len = cnt - pcnt;
1069 for (k=1; k<bs; k++) {
1070 ierr = PetscArraycpy(&column_indices[cnt],&column_indices[pcnt],len)((sizeof(*(&column_indices[cnt])) != sizeof(*(&column_indices
[pcnt]))) || PetscMemcpy(&column_indices[cnt],&column_indices
[pcnt],(len)*sizeof(*(&column_indices[cnt]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1070,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1071 cnt += len;
1072 }
1073 }
1074 if (cnt != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"Internal PETSc error: cnt = %D nz = %D",cnt,nz)return PetscError(((MPI_Comm)0x44000001),1074,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,76,PETSC_ERROR_INITIAL,"Internal PETSc error: cnt = %D nz = %D"
,cnt,nz)
;
1075
1076 /* store the columns to the file */
1077 ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1077,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1078 if (!rank) {
1079 MPI_Status status;
1080 ierr = PetscBinaryWrite(fd,column_indices,nz,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1080,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1081 for (i=1; i<size; i++) {
1082 ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1082,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1083 ierr = MPI_Recv(&cnt,1,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_recv_len)) || MPI_Recv((&cnt),(1
),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm((PetscObject
)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1083,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1084 ierr = MPI_Recv(column_indices,cnt,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((cnt),(((MPI_Datatype
)0x4c000405)),(&petsc_recv_len)) || MPI_Recv((column_indices
),(cnt),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm
((PetscObject)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1084,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1085 ierr = PetscBinaryWrite(fd,column_indices,cnt,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1085,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1086 }
1087 ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1087,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1088 } else {
1089 ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1089,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1090 ierr = MPI_Send(&cnt,1,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_send_len)) || MPI_Send((&cnt),(1
),(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm((PetscObject
)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1090,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1091 ierr = MPI_Send(column_indices,cnt,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((cnt),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Send((column_indices
),(cnt),(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm
((PetscObject)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1091,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1092 ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1092,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1093 }
1094 ierr = PetscFree(column_indices)((*PetscTrFree)((void*)(column_indices),1094,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((column_indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1094,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1095
1096 /* load up the numerical values */
1097 ierr = PetscMalloc1(nzmax,&column_values)PetscMallocA(1,PETSC_FALSE,1097,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(nzmax)*sizeof(**(&column_values)),(&column_values
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1097,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1098 cnt = 0;
1099 for (i=0; i<a->mbs; i++) {
1100 rlen = bs*(B->i[i+1] - B->i[i] + A->i[i+1] - A->i[i]);
1101 for (j=B->i[i]; j<B->i[i+1]; j++) {
1102 if (garray[B->j[j]] > cstart) break;
1103 for (l=0; l<bs; l++) {
1104 for (ll=0; ll<bs; ll++) {
1105 column_values[cnt + l*rlen + ll] = B->a[bs2*j+l+bs*ll];
1106 }
1107 }
1108 cnt += bs;
1109 }
1110 for (k=A->i[i]; k<A->i[i+1]; k++) {
1111 for (l=0; l<bs; l++) {
1112 for (ll=0; ll<bs; ll++) {
1113 column_values[cnt + l*rlen + ll] = A->a[bs2*k+l+bs*ll];
1114 }
1115 }
1116 cnt += bs;
1117 }
1118 for (; j<B->i[i+1]; j++) {
1119 for (l=0; l<bs; l++) {
1120 for (ll=0; ll<bs; ll++) {
1121 column_values[cnt + l*rlen + ll] = B->a[bs2*j+l+bs*ll];
1122 }
1123 }
1124 cnt += bs;
1125 }
1126 cnt += (bs-1)*rlen;
1127 }
1128 if (cnt != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Internal PETSc error: cnt = %D nz = %D",cnt,nz)return PetscError(((MPI_Comm)0x44000001),1128,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,77,PETSC_ERROR_INITIAL,"Internal PETSc error: cnt = %D nz = %D"
,cnt,nz)
;
1129
1130 /* store the column values to the file */
1131 ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1131,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1132 if (!rank) {
1133 MPI_Status status;
1134 ierr = PetscBinaryWrite(fd,column_values,nz,PETSC_SCALARPETSC_DOUBLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1134,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1135 for (i=1; i<size; i++) {
1136 ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1136,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1137 ierr = MPI_Recv(&cnt,1,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_recv_len)) || MPI_Recv((&cnt),(1
),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm((PetscObject
)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1137,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1138 ierr = MPI_Recv(column_values,cnt,MPIU_SCALAR,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((cnt),(((MPI_Datatype
)0x4c00080b)),(&petsc_recv_len)) || MPI_Recv((column_values
),(cnt),(((MPI_Datatype)0x4c00080b)),(i),(tag),(PetscObjectComm
((PetscObject)mat)),(&status)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1138,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1139 ierr = PetscBinaryWrite(fd,column_values,cnt,PETSC_SCALARPETSC_DOUBLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1139,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1140 }
1141 ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1141,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1142 } else {
1143 ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1143,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1144 ierr = MPI_Send(&nz,1,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_send_len)) || MPI_Send((&nz),(1)
,(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm((PetscObject
)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1144,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1145 ierr = MPI_Send(column_values,nz,MPIU_SCALAR,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((nz),(((MPI_Datatype
)0x4c00080b)),(&petsc_send_len)) || MPI_Send((column_values
),(nz),(((MPI_Datatype)0x4c00080b)),(0),(tag),(PetscObjectComm
((PetscObject)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1145,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1146 ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1146,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1147 }
1148 ierr = PetscFree(column_values)((*PetscTrFree)((void*)(column_values),1148,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((column_values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1148,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1149
1150 ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1150,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1151 if (file) {
1152 fprintf(file,"-matload_block_size %d\n",(int)mat->rmap->bs);
1153 }
1154 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1155}
1156
1157PetscErrorCode MatView_MPISBAIJ(Mat mat,PetscViewer viewer)
1158{
1159 PetscErrorCode ierr;
1160 PetscBool iascii,isdraw,issocket,isbinary;
1161
1162 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1162; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1163 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1163,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1164 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1165 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSOCKET"socket",&issocket);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1165,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1166 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1166,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1167 if (iascii || isdraw || issocket) {
1168 ierr = MatView_MPISBAIJ_ASCIIorDraworSocket(mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1168,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1169 } else if (isbinary) {
1170 ierr = MatView_MPISBAIJ_Binary(mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1170,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1171 }
1172 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1173}
1174
1175PetscErrorCode MatDestroy_MPISBAIJ(Mat mat)
1176{
1177 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1178 PetscErrorCode ierr;
1179
1180 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1180; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1181#if defined(PETSC_USE_LOG1)
1182 PetscLogObjectState((PetscObject)mat,"Rows=%D,Cols=%D",mat->rmap->N,mat->cmap->N);
1183#endif
1184 ierr = MatStashDestroy_Private(&mat->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1184,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1185 ierr = MatStashDestroy_Private(&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1185,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1186 ierr = MatDestroy(&baij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1186,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1187 ierr = MatDestroy(&baij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1187,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1188#if defined(PETSC_USE_CTABLE1)
1189 ierr = PetscTableDestroy(&baij->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1189,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1190#else
1191 ierr = PetscFree(baij->colmap)((*PetscTrFree)((void*)(baij->colmap),1191,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->colmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1191,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1192#endif
1193 ierr = PetscFree(baij->garray)((*PetscTrFree)((void*)(baij->garray),1193,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->garray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1193,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1194 ierr = VecDestroy(&baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1194,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1195 ierr = VecScatterDestroy(&baij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1195,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1196 ierr = VecDestroy(&baij->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1196,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1197 ierr = VecDestroy(&baij->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1197,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1198 ierr = VecDestroy(&baij->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1198,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1199 ierr = VecDestroy(&baij->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1199,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1200 ierr = VecDestroy(&baij->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1200,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1201 ierr = VecScatterDestroy(&baij->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1201,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1202 ierr = PetscFree2(baij->rowvalues,baij->rowindices)PetscFreeA(2,1202,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(baij->rowvalues),&(baij->rowindices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1202,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1203 ierr = PetscFree(baij->barray)((*PetscTrFree)((void*)(baij->barray),1203,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->barray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1203,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1204 ierr = PetscFree(baij->hd)((*PetscTrFree)((void*)(baij->hd),1204,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->hd) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1204,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1205 ierr = VecDestroy(&baij->diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1205,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1206 ierr = VecDestroy(&baij->bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1206,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1207 ierr = VecDestroy(&baij->xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1207,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1208#if defined(PETSC_USE_REAL_MAT_SINGLE)
1209 ierr = PetscFree(baij->setvaluescopy)((*PetscTrFree)((void*)(baij->setvaluescopy),1209,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->setvaluescopy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1209,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1210#endif
1211 ierr = PetscFree(baij->in_loc)((*PetscTrFree)((void*)(baij->in_loc),1211,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->in_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1211,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1212 ierr = PetscFree(baij->v_loc)((*PetscTrFree)((void*)(baij->v_loc),1212,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->v_loc) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1212,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1213 ierr = PetscFree(baij->rangebs)((*PetscTrFree)((void*)(baij->rangebs),1213,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((baij->rangebs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1213,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1214 ierr = PetscFree(mat->data)((*PetscTrFree)((void*)(mat->data),1214,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((mat->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1214,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1215
1216 ierr = PetscObjectChangeTypeName((PetscObject)mat,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1216,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1217 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatStoreValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatStoreValues_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1217,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1218 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatRetrieveValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatRetrieveValues_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1218,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1219 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatMPISBAIJSetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatMPISBAIJSetPreallocation_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1219,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1220#if defined(PETSC_HAVE_ELEMENTAL)
1221 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_elemental_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_elemental_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1221,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1222#endif
1223 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_mpiaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_mpiaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1223,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1224 ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_mpibaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_mpibaij_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1224,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1225 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1226}
1227
1228PetscErrorCode MatMult_MPISBAIJ_Hermitian(Mat A,Vec xx,Vec yy)
1229{
1230 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1231 PetscErrorCode ierr;
1232 PetscInt nt,mbs=a->mbs,bs=A->rmap->bs;
1233 PetscScalar *from;
1234 const PetscScalar *x;
1235
1236 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1236; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1237 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1237,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1238 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1239
1240 /* diagonal part */
1241 ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1241,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1242 ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1242,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1243
1244 /* subdiagonal part */
1245 ierr = (*a->B->ops->multhermitiantranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1245,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1246
1247 /* copy x into the vec slvec0 */
1248 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1248,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1249 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1249,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1250
1251 ierr = PetscArraycpy(from,x,bs*mbs)((sizeof(*(from)) != sizeof(*(x))) || PetscMemcpy(from,x,(bs*
mbs)*sizeof(*(from))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1251,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1252 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1252,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1253 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1253,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1254
1255 ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1255,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1256 ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1256,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1257 /* supperdiagonal part */
1258 ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1258,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1259 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1260}
1261
1262PetscErrorCode MatMult_MPISBAIJ(Mat A,Vec xx,Vec yy)
1263{
1264 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1265 PetscErrorCode ierr;
1266 PetscInt nt,mbs=a->mbs,bs=A->rmap->bs;
1267 PetscScalar *from;
1268 const PetscScalar *x;
1269
1270 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1270; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1271 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1271,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1272 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1272,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1273
1274 /* diagonal part */
1275 ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1275,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1276 ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1276,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1277
1278 /* subdiagonal part */
1279 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1279,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1280
1281 /* copy x into the vec slvec0 */
1282 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1282,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1283 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1283,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1284
1285 ierr = PetscArraycpy(from,x,bs*mbs)((sizeof(*(from)) != sizeof(*(x))) || PetscMemcpy(from,x,(bs*
mbs)*sizeof(*(from))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1285,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1286 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1287 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1288
1289 ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1289,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1290 ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1290,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1291 /* supperdiagonal part */
1292 ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1292,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1293 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1294}
1295
1296PetscErrorCode MatMult_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy)
1297{
1298 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1299 PetscErrorCode ierr;
1300 PetscInt nt;
1301
1302 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1302; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1303 ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1303,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1304 if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1304,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx")
;
1305
1306 ierr = VecGetLocalSize(yy,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1306,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1307 if (nt != A->rmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible parition of A and yy")return PetscError(((MPI_Comm)0x44000001),1307,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Incompatible parition of A and yy")
;
1308
1309 ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1309,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1310 /* do diagonal part */
1311 ierr = (*a->A->ops->mult)(a->A,xx,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1311,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1312 /* do supperdiagonal part */
1313 ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1313,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1314 ierr = (*a->B->ops->multadd)(a->B,a->lvec,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1314,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1315 /* do subdiagonal part */
1316 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1316,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1317 ierr = VecScatterBegin(a->Mvctx,a->lvec,yy,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1317,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1318 ierr = VecScatterEnd(a->Mvctx,a->lvec,yy,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1318,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1319 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1320}
1321
1322PetscErrorCode MatMultAdd_MPISBAIJ(Mat A,Vec xx,Vec yy,Vec zz)
1323{
1324 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1325 PetscErrorCode ierr;
1326 PetscInt mbs=a->mbs,bs=A->rmap->bs;
1327 PetscScalar *from,zero=0.0;
1328 const PetscScalar *x;
1329
1330 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1330; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1331 /*
1332 PetscSynchronizedPrintf(PetscObjectComm((PetscObject)A)," MatMultAdd is called ...\n");
1333 PetscSynchronizedFlush(PetscObjectComm((PetscObject)A),PETSC_STDOUT);
1334 */
1335 /* diagonal part */
1336 ierr = (*a->A->ops->multadd)(a->A,xx,yy,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1336,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1337 ierr = VecSet(a->slvec1b,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1337,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1338
1339 /* subdiagonal part */
1340 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1340,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1341
1342 /* copy x into the vec slvec0 */
1343 ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1343,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1344 ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1344,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1345 ierr = PetscArraycpy(from,x,bs*mbs)((sizeof(*(from)) != sizeof(*(x))) || PetscMemcpy(from,x,(bs*
mbs)*sizeof(*(from))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1345,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1346 ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1346,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1347
1348 ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1348,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1349 ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1349,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1350 ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1350,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1351
1352 /* supperdiagonal part */
1353 ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1353,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1354 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1355}
1356
1357PetscErrorCode MatMultAdd_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy,Vec zz)
1358{
1359 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1360 PetscErrorCode ierr;
1361
1362 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1362; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1363 ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1363,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1364 /* do diagonal part */
1365 ierr = (*a->A->ops->multadd)(a->A,xx,yy,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1365,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1366 /* do supperdiagonal part */
1367 ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1367,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1368 ierr = (*a->B->ops->multadd)(a->B,a->lvec,zz,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1368,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1369
1370 /* do subdiagonal part */
1371 ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1371,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1372 ierr = VecScatterBegin(a->Mvctx,a->lvec,zz,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1372,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1373 ierr = VecScatterEnd(a->Mvctx,a->lvec,zz,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1373,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1374 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1375}
1376
1377/*
1378 This only works correctly for square matrices where the subblock A->A is the
1379 diagonal block
1380*/
1381PetscErrorCode MatGetDiagonal_MPISBAIJ(Mat A,Vec v)
1382{
1383 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1384 PetscErrorCode ierr;
1385
1386 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1386; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1387 /* if (a->rmap->N != a->cmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Supports only square matrix where A->A is diag block"); */
1388 ierr = MatGetDiagonal(a->A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1388,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1389 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1390}
1391
1392PetscErrorCode MatScale_MPISBAIJ(Mat A,PetscScalar aa)
1393{
1394 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1395 PetscErrorCode ierr;
1396
1397 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1397; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1398 ierr = MatScale(a->A,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1398,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1399 ierr = MatScale(a->B,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1399,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1400 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1401}
1402
1403PetscErrorCode MatGetRow_MPISBAIJ(Mat matin,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1404{
1405 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
1406 PetscScalar *vworkA,*vworkB,**pvA,**pvB,*v_p;
1407 PetscErrorCode ierr;
1408 PetscInt bs = matin->rmap->bs,bs2 = mat->bs2,i,*cworkA,*cworkB,**pcA,**pcB;
1409 PetscInt nztot,nzA,nzB,lrow,brstart = matin->rmap->rstart,brend = matin->rmap->rend;
1410 PetscInt *cmap,*idx_p,cstart = mat->rstartbs;
1411
1412 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1412; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1413 if (mat->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Already active")return PetscError(((MPI_Comm)0x44000001),1413,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Already active")
;
1414 mat->getrowactive = PETSC_TRUE;
1415
1416 if (!mat->rowvalues && (idx || v)) {
1417 /*
1418 allocate enough space to hold information from the longest row.
1419 */
1420 Mat_SeqSBAIJ *Aa = (Mat_SeqSBAIJ*)mat->A->data;
1421 Mat_SeqBAIJ *Ba = (Mat_SeqBAIJ*)mat->B->data;
1422 PetscInt max = 1,mbs = mat->mbs,tmp;
1423 for (i=0; i<mbs; i++) {
1424 tmp = Aa->i[i+1] - Aa->i[i] + Ba->i[i+1] - Ba->i[i]; /* row length */
1425 if (max < tmp) max = tmp;
1426 }
1427 ierr = PetscMalloc2(max*bs2,&mat->rowvalues,max*bs2,&mat->rowindices)PetscMallocA(2,PETSC_FALSE,1427,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(max*bs2)*sizeof(**(&mat->rowvalues)),(&mat
->rowvalues),(size_t)(max*bs2)*sizeof(**(&mat->rowindices
)),(&mat->rowindices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1427,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1428 }
1429
1430 if (row < brstart || row >= brend) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only local rows")return PetscError(((MPI_Comm)0x44000001),1430,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only local rows")
;
1431 lrow = row - brstart; /* local row index */
1432
1433 pvA = &vworkA; pcA = &cworkA; pvB = &vworkB; pcB = &cworkB;
1434 if (!v) {pvA = 0; pvB = 0;}
1435 if (!idx) {pcA = 0; if (!v) pcB = 0;}
1436 ierr = (*mat->A->ops->getrow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1436,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1437 ierr = (*mat->B->ops->getrow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1437,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1438 nztot = nzA + nzB;
1439
1440 cmap = mat->garray;
1441 if (v || idx) {
1442 if (nztot) {
1443 /* Sort by increasing column numbers, assuming A and B already sorted */
1444 PetscInt imark = -1;
1445 if (v) {
1446 *v = v_p = mat->rowvalues;
1447 for (i=0; i<nzB; i++) {
1448 if (cmap[cworkB[i]/bs] < cstart) v_p[i] = vworkB[i];
1449 else break;
1450 }
1451 imark = i;
1452 for (i=0; i<nzA; i++) v_p[imark+i] = vworkA[i];
1453 for (i=imark; i<nzB; i++) v_p[nzA+i] = vworkB[i];
1454 }
1455 if (idx) {
1456 *idx = idx_p = mat->rowindices;
1457 if (imark > -1) {
1458 for (i=0; i<imark; i++) {
1459 idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs;
1460 }
1461 } else {
1462 for (i=0; i<nzB; i++) {
1463 if (cmap[cworkB[i]/bs] < cstart) idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs;
1464 else break;
1465 }
1466 imark = i;
1467 }
1468 for (i=0; i<nzA; i++) idx_p[imark+i] = cstart*bs + cworkA[i];
1469 for (i=imark; i<nzB; i++) idx_p[nzA+i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs ;
1470 }
1471 } else {
1472 if (idx) *idx = 0;
1473 if (v) *v = 0;
1474 }
1475 }
1476 *nz = nztot;
1477 ierr = (*mat->A->ops->restorerow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1477,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1478 ierr = (*mat->B->ops->restorerow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1478,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1479 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1480}
1481
1482PetscErrorCode MatRestoreRow_MPISBAIJ(Mat mat,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v)
1483{
1484 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1485
1486 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1486; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1487 if (!baij->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"MatGetRow() must be called first")return PetscError(((MPI_Comm)0x44000001),1487,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"MatGetRow() must be called first")
;
1488 baij->getrowactive = PETSC_FALSE;
1489 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1490}
1491
1492PetscErrorCode MatGetRowUpperTriangular_MPISBAIJ(Mat A)
1493{
1494 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1495 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1496
1497 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1497; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1498 aA->getrow_utriangular = PETSC_TRUE;
1499 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1500}
1501PetscErrorCode MatRestoreRowUpperTriangular_MPISBAIJ(Mat A)
1502{
1503 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1504 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1505
1506 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1506; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1507 aA->getrow_utriangular = PETSC_FALSE;
1508 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1509}
1510
1511PetscErrorCode MatRealPart_MPISBAIJ(Mat A)
1512{
1513 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1514 PetscErrorCode ierr;
1515
1516 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1516; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1517 ierr = MatRealPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1517,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1518 ierr = MatRealPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1518,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1519 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1520}
1521
1522PetscErrorCode MatImaginaryPart_MPISBAIJ(Mat A)
1523{
1524 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1525 PetscErrorCode ierr;
1526
1527 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1527; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1528 ierr = MatImaginaryPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1528,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1529 ierr = MatImaginaryPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1529,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1530 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1531}
1532
1533/* Check if isrow is a subset of iscol_local, called by MatCreateSubMatrix_MPISBAIJ()
1534 Input: isrow - distributed(parallel),
1535 iscol_local - locally owned (seq)
1536*/
1537PetscErrorCode ISEqual_private(IS isrow,IS iscol_local,PetscBool *flg)
1538{
1539 PetscErrorCode ierr;
1540 PetscInt sz1,sz2,*a1,*a2,i,j,k,nmatch;
1541 const PetscInt *ptr1,*ptr2;
1542
1543 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1543; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1544 ierr = ISGetLocalSize(isrow,&sz1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1544,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1545 ierr = ISGetLocalSize(iscol_local,&sz2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1545,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1546 if (sz1 > sz2) {
1547 *flg = PETSC_FALSE;
1548 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1549 }
1550
1551 ierr = ISGetIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1551,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1552 ierr = ISGetIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1552,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1553
1554 ierr = PetscMalloc1(sz1,&a1)PetscMallocA(1,PETSC_FALSE,1554,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(sz1)*sizeof(**(&a1)),(&a1))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1554,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1555 ierr = PetscMalloc1(sz2,&a2)PetscMallocA(1,PETSC_FALSE,1555,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(sz2)*sizeof(**(&a2)),(&a2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1555,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1556 ierr = PetscArraycpy(a1,ptr1,sz1)((sizeof(*(a1)) != sizeof(*(ptr1))) || PetscMemcpy(a1,ptr1,(sz1
)*sizeof(*(a1))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1556,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1557 ierr = PetscArraycpy(a2,ptr2,sz2)((sizeof(*(a2)) != sizeof(*(ptr2))) || PetscMemcpy(a2,ptr2,(sz2
)*sizeof(*(a2))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1557,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1558 ierr = PetscSortInt(sz1,a1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1558,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1559 ierr = PetscSortInt(sz2,a2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1559,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1560
1561 nmatch=0;
1562 k = 0;
1563 for (i=0; i<sz1; i++){
1564 for (j=k; j<sz2; j++){
1565 if (a1[i] == a2[j]) {
1566 k = j; nmatch++;
1567 break;
1568 }
1569 }
1570 }
1571 ierr = ISRestoreIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1571,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1572 ierr = ISRestoreIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1572,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1573 ierr = PetscFree(a1)((*PetscTrFree)((void*)(a1),1573,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((a1) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1573,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1574 ierr = PetscFree(a2)((*PetscTrFree)((void*)(a2),1574,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((a2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1574,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1575 if (nmatch < sz1) {
1576 *flg = PETSC_FALSE;
1577 } else {
1578 *flg = PETSC_TRUE;
1579 }
1580 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1581}
1582
1583PetscErrorCode MatCreateSubMatrix_MPISBAIJ(Mat mat,IS isrow,IS iscol,MatReuse call,Mat *newmat)
1584{
1585 PetscErrorCode ierr;
1586 IS iscol_local;
1587 PetscInt csize;
1588 PetscBool isequal;
1589
1590 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1590; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1591 ierr = ISGetLocalSize(iscol,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1591,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1592 if (call == MAT_REUSE_MATRIX) {
1593 ierr = PetscObjectQuery((PetscObject)*newmat,"ISAllGather",(PetscObject*)&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1593,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1594 if (!iscol_local) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Submatrix passed in was not used before, cannot reuse")return PetscError(((MPI_Comm)0x44000001),1594,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Submatrix passed in was not used before, cannot reuse"
)
;
1595 } else {
1596 ierr = ISAllGather(iscol,&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1596,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1597 ierr = ISEqual_private(isrow,iscol_local,&isequal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1597,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1598 if (!isequal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"For symmetric format, iscol must equal isrow")return PetscError(((MPI_Comm)0x44000001),1598,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,75,PETSC_ERROR_INITIAL,"For symmetric format, iscol must equal isrow"
)
;
1599 }
1600
1601 /* now call MatCreateSubMatrix_MPIBAIJ() */
1602 ierr = MatCreateSubMatrix_MPIBAIJ_Private(mat,isrow,iscol_local,csize,call,newmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1602,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1603 if (call == MAT_INITIAL_MATRIX) {
1604 ierr = PetscObjectCompose((PetscObject)*newmat,"ISAllGather",(PetscObject)iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1604,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1605 ierr = ISDestroy(&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1605,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1606 }
1607 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1608}
1609
1610PetscErrorCode MatZeroEntries_MPISBAIJ(Mat A)
1611{
1612 Mat_MPISBAIJ *l = (Mat_MPISBAIJ*)A->data;
1613 PetscErrorCode ierr;
1614
1615 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1615; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1616 ierr = MatZeroEntries(l->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1616,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1617 ierr = MatZeroEntries(l->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1617,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1618 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1619}
1620
1621PetscErrorCode MatGetInfo_MPISBAIJ(Mat matin,MatInfoType flag,MatInfo *info)
1622{
1623 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)matin->data;
1624 Mat A = a->A,B = a->B;
1625 PetscErrorCode ierr;
1626 PetscReal isend[5],irecv[5];
1627
1628 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1628; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1629 info->block_size = (PetscReal)matin->rmap->bs;
1630
1631 ierr = MatGetInfo(A,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1631,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1632
1633 isend[0] = info->nz_used; isend[1] = info->nz_allocated; isend[2] = info->nz_unneeded;
1634 isend[3] = info->memory; isend[4] = info->mallocs;
1635
1636 ierr = MatGetInfo(B,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1636,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1637
1638 isend[0] += info->nz_used; isend[1] += info->nz_allocated; isend[2] += info->nz_unneeded;
1639 isend[3] += info->memory; isend[4] += info->mallocs;
1640 if (flag == MAT_LOCAL) {
1641 info->nz_used = isend[0];
1642 info->nz_allocated = isend[1];
1643 info->nz_unneeded = isend[2];
1644 info->memory = isend[3];
1645 info->mallocs = isend[4];
1646 } else if (flag == MAT_GLOBAL_MAX) {
1647 ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin
),5,1647,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)matin))),0) || MPI_Allreduce((isend),(irecv),(5
),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000001)),(PetscObjectComm
((PetscObject)matin)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1647,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1648
1649 info->nz_used = irecv[0];
1650 info->nz_allocated = irecv[1];
1651 info->nz_unneeded = irecv[2];
1652 info->memory = irecv[3];
1653 info->mallocs = irecv[4];
1654 } else if (flag == MAT_GLOBAL_SUM) {
1655 ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin
),5,1655,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)matin))),0) || MPI_Allreduce((isend),(irecv),(5
),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003)),(PetscObjectComm
((PetscObject)matin)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1655,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1656
1657 info->nz_used = irecv[0];
1658 info->nz_allocated = irecv[1];
1659 info->nz_unneeded = irecv[2];
1660 info->memory = irecv[3];
1661 info->mallocs = irecv[4];
1662 } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown MatInfoType argument %d",(int)flag)return PetscError(((MPI_Comm)0x44000001),1662,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Unknown MatInfoType argument %d",(int
)flag)
;
1663 info->fill_ratio_given = 0; /* no parallel LU/ILU/Cholesky */
1664 info->fill_ratio_needed = 0;
1665 info->factor_mallocs = 0;
1666 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1667}
1668
1669PetscErrorCode MatSetOption_MPISBAIJ(Mat A,MatOption op,PetscBool flg)
1670{
1671 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1672 Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data;
1673 PetscErrorCode ierr;
1674
1675 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1675; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1676 switch (op) {
1677 case MAT_NEW_NONZERO_LOCATIONS:
1678 case MAT_NEW_NONZERO_ALLOCATION_ERR:
1679 case MAT_UNUSED_NONZERO_LOCATION_ERR:
1680 case MAT_KEEP_NONZERO_PATTERN:
1681 case MAT_SUBMAT_SINGLEIS:
1682 case MAT_NEW_NONZERO_LOCATION_ERR:
1683 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1683,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1684 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1684,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1685 ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1685,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1686 break;
1687 case MAT_ROW_ORIENTED:
1688 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1688,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1689 a->roworiented = flg;
1690
1691 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1691,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1692 ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1692,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1693 break;
1694 case MAT_NEW_DIAGONALS:
1695 case MAT_SORTED_FULL:
1696 ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions
[op])
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1696,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1697 break;
1698 case MAT_IGNORE_OFF_PROC_ENTRIES:
1699 a->donotstash = flg;
1700 break;
1701 case MAT_USE_HASH_TABLE:
1702 a->ht_flag = flg;
1703 break;
1704 case MAT_HERMITIAN:
1705 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1705,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1706 if (!A->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must call MatAssemblyEnd() first")return PetscError(((MPI_Comm)0x44000001),1706,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatAssemblyEnd() first")
;
1707 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1707,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1708#if defined(PETSC_USE_COMPLEX)
1709 A->ops->mult = MatMult_MPISBAIJ_Hermitian;
1710#endif
1711 break;
1712 case MAT_SPD:
1713 A->spd_set = PETSC_TRUE;
1714 A->spd = flg;
1715 if (flg) {
1716 A->symmetric = PETSC_TRUE;
1717 A->structurally_symmetric = PETSC_TRUE;
1718 A->symmetric_set = PETSC_TRUE;
1719 A->structurally_symmetric_set = PETSC_TRUE;
1720 }
1721 break;
1722 case MAT_SYMMETRIC:
1723 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1723,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1724 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1724,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1725 break;
1726 case MAT_STRUCTURALLY_SYMMETRIC:
1727 MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return
PetscError(((MPI_Comm)0x44000001),1727,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()"
,(1),"A",__func__); } while (0)
;
1728 ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1728,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1729 break;
1730 case MAT_SYMMETRY_ETERNAL:
1731 if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Matrix must be symmetric")return PetscError(((MPI_Comm)0x44000001),1731,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Matrix must be symmetric")
;
1732 ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions
[op])
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1732,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1733 break;
1734 case MAT_IGNORE_LOWER_TRIANGULAR:
1735 aA->ignore_ltriangular = flg;
1736 break;
1737 case MAT_ERROR_LOWER_TRIANGULAR:
1738 aA->ignore_ltriangular = flg;
1739 break;
1740 case MAT_GETROW_UPPERTRIANGULAR:
1741 aA->getrow_utriangular = flg;
1742 break;
1743 default:
1744 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1744,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"unknown option %d",op)
;
1745 }
1746 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1747}
1748
1749PetscErrorCode MatTranspose_MPISBAIJ(Mat A,MatReuse reuse,Mat *B)
1750{
1751 PetscErrorCode ierr;
1752
1753 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1753; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1754 if (reuse == MAT_INITIAL_MATRIX) {
1755 ierr = MatDuplicate(A,MAT_COPY_VALUES,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1755,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1756 } else if (reuse == MAT_REUSE_MATRIX) {
1757 ierr = MatCopy(A,*B,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1757,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1758 }
1759 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1760}
1761
1762PetscErrorCode MatDiagonalScale_MPISBAIJ(Mat mat,Vec ll,Vec rr)
1763{
1764 Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data;
1765 Mat a = baij->A, b=baij->B;
1766 PetscErrorCode ierr;
1767 PetscInt nv,m,n;
1768 PetscBool flg;
1769
1770 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1770; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1771 if (ll != rr) {
1772 ierr = VecEqual(ll,rr,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1772,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1773 if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"For symmetric format, left and right scaling vectors must be same\n")return PetscError(((MPI_Comm)0x44000001),1773,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"For symmetric format, left and right scaling vectors must be same\n"
)
;
1774 }
1775 if (!ll) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1776
1777 ierr = MatGetLocalSize(mat,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1777,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1778 if (m != n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"For symmetric format, local size %d %d must be same",m,n)return PetscError(((MPI_Comm)0x44000001),1778,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"For symmetric format, local size %d %d must be same"
,m,n)
;
1779
1780 ierr = VecGetLocalSize(rr,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1780,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1781 if (nv!=n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left and right vector non-conforming local size")return PetscError(((MPI_Comm)0x44000001),1781,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Left and right vector non-conforming local size"
)
;
1782
1783 ierr = VecScatterBegin(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1783,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1784
1785 /* left diagonalscale the off-diagonal part */
1786 ierr = (*b->ops->diagonalscale)(b,ll,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1786,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1787
1788 /* scale the diagonal part */
1789 ierr = (*a->ops->diagonalscale)(a,ll,rr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1789,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1790
1791 /* right diagonalscale the off-diagonal part */
1792 ierr = VecScatterEnd(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1792,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1793 ierr = (*b->ops->diagonalscale)(b,NULL((void*)0),baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1793,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1794 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1795}
1796
1797PetscErrorCode MatSetUnfactored_MPISBAIJ(Mat A)
1798{
1799 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1800 PetscErrorCode ierr;
1801
1802 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1802; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1803 ierr = MatSetUnfactored(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1803,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1804 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1805}
1806
1807static PetscErrorCode MatDuplicate_MPISBAIJ(Mat,MatDuplicateOption,Mat*);
1808
1809PetscErrorCode MatEqual_MPISBAIJ(Mat A,Mat B,PetscBool *flag)
1810{
1811 Mat_MPISBAIJ *matB = (Mat_MPISBAIJ*)B->data,*matA = (Mat_MPISBAIJ*)A->data;
1812 Mat a,b,c,d;
1813 PetscBool flg;
1814 PetscErrorCode ierr;
1815
1816 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1816; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1817 a = matA->A; b = matA->B;
1818 c = matB->A; d = matB->B;
1819
1820 ierr = MatEqual(a,c,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1820,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1821 if (flg) {
1822 ierr = MatEqual(b,d,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1822,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1823 }
1824 ierr = MPIU_Allreduce(&flg,flag,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)A))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)A),1
,1824,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)A))),0) || MPI_Allreduce((&flg),(flag),(1),
(MPIU_BOOL),((MPI_Op)(0x58000005)),(PetscObjectComm((PetscObject
)A)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1824,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1825 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1826}
1827
1828PetscErrorCode MatCopy_MPISBAIJ(Mat A,Mat B,MatStructure str)
1829{
1830 PetscErrorCode ierr;
1831 PetscBool isbaij;
1832
1833 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1833; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1834 ierr = PetscObjectTypeCompareAny((PetscObject)B,&isbaij,MATSEQSBAIJ"seqsbaij",MATMPISBAIJ"mpisbaij","");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1834,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1835 if (!isbaij) SETERRQ1(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"Not for matrix type %s",((PetscObject)B)->type_name)return PetscError(PetscObjectComm((PetscObject)B),1835,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Not for matrix type %s",((PetscObject
)B)->type_name)
;
1836 /* If the two matrices don't have the same copy implementation, they aren't compatible for fast copy. */
1837 if ((str != SAME_NONZERO_PATTERN) || (A->ops->copy != B->ops->copy)) {
1838 ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1838,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1839 ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1839,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1840 ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1840,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1841 } else {
1842 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1843 Mat_MPISBAIJ *b = (Mat_MPISBAIJ*)B->data;
1844
1845 ierr = MatCopy(a->A,b->A,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1845,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1846 ierr = MatCopy(a->B,b->B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1846,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1847 }
1848 ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1848,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1849 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1850}
1851
1852PetscErrorCode MatSetUp_MPISBAIJ(Mat A)
1853{
1854 PetscErrorCode ierr;
1855
1856 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1856; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1857 ierr = MatMPISBAIJSetPreallocation(A,A->rmap->bs,PETSC_DEFAULT-2,0,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1857,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1858 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1859}
1860
1861PetscErrorCode MatAXPY_MPISBAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str)
1862{
1863 PetscErrorCode ierr;
1864 Mat_MPISBAIJ *xx=(Mat_MPISBAIJ*)X->data,*yy=(Mat_MPISBAIJ*)Y->data;
1865 PetscBLASInt bnz,one=1;
1866 Mat_SeqSBAIJ *xa,*ya;
1867 Mat_SeqBAIJ *xb,*yb;
1868
1869 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1869; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1870 if (str == SAME_NONZERO_PATTERN) {
1871 PetscScalar alpha = a;
1872 xa = (Mat_SeqSBAIJ*)xx->A->data;
1873 ya = (Mat_SeqSBAIJ*)yy->A->data;
1874 ierr = PetscBLASIntCast(xa->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1874,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1875 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,xa->a,&one,ya->a,&one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASaxpy"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1875; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
daxpy_(&bnz,&alpha,xa->a,&one,ya->a,&one
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(1875
,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1875,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do {
; if (petscstack && petscstack->currentsize > 0
) { petscstack->currentsize--; petscstack->function[petscstack
->currentsize] = 0; petscstack->file[petscstack->currentsize
] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; }
if (petscstack) { petscstack->hotdepth = (((petscstack->
hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ;
} while (0); } while (0); } while(0)
;
1876 xb = (Mat_SeqBAIJ*)xx->B->data;
1877 yb = (Mat_SeqBAIJ*)yy->B->data;
1878 ierr = PetscBLASIntCast(xb->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1878,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1879 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,xb->a,&one,yb->a,&one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASaxpy"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1879; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
daxpy_(&bnz,&alpha,xb->a,&one,yb->a,&one
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(1879
,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),1879,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do {
; if (petscstack && petscstack->currentsize > 0
) { petscstack->currentsize--; petscstack->function[petscstack
->currentsize] = 0; petscstack->file[petscstack->currentsize
] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; }
if (petscstack) { petscstack->hotdepth = (((petscstack->
hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ;
} while (0); } while (0); } while(0)
;
1880 ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1880,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1881 } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */
1882 ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1882,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1883 ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1883,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1884 ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1884,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1885 } else {
1886 Mat B;
1887 PetscInt *nnz_d,*nnz_o,bs=Y->rmap->bs;
1888 if (bs != X->rmap->bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Matrices must have same block size")return PetscError(((MPI_Comm)0x44000001),1888,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"Matrices must have same block size")
;
1889 ierr = MatGetRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1889,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1890 ierr = MatGetRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1890,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1891 ierr = PetscMalloc1(yy->A->rmap->N,&nnz_d)PetscMallocA(1,PETSC_FALSE,1891,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(yy->A->rmap->N)*sizeof(**(&nnz_d)),(&
nnz_d))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1891,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1892 ierr = PetscMalloc1(yy->B->rmap->N,&nnz_o)PetscMallocA(1,PETSC_FALSE,1892,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(yy->B->rmap->N)*sizeof(**(&nnz_o)),(&
nnz_o))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1892,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1893 ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1893,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1894 ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1894,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1895 ierr = MatSetSizes(B,Y->rmap->n,Y->cmap->n,Y->rmap->N,Y->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1895,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1896 ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1896,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1897 ierr = MatSetType(B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1897,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1898 ierr = MatAXPYGetPreallocation_SeqSBAIJ(yy->A,xx->A,nnz_d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1898,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1899 ierr = MatAXPYGetPreallocation_MPIBAIJ(yy->B,yy->garray,xx->B,xx->garray,nnz_o);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1899,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1900 ierr = MatMPISBAIJSetPreallocation(B,bs,0,nnz_d,0,nnz_o);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1900,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1901 ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1901,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1902 ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1902,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1903 ierr = PetscFree(nnz_d)((*PetscTrFree)((void*)(nnz_d),1903,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((nnz_d) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1903,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1904 ierr = PetscFree(nnz_o)((*PetscTrFree)((void*)(nnz_o),1904,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((nnz_o) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1904,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1905 ierr = MatRestoreRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1905,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1906 ierr = MatRestoreRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1906,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1907 }
1908 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1909}
1910
1911PetscErrorCode MatCreateSubMatrices_MPISBAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[])
1912{
1913 PetscErrorCode ierr;
1914 PetscInt i;
1915 PetscBool flg;
1916
1917 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1917; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1918 ierr = MatCreateSubMatrices_MPIBAIJ(A,n,irow,icol,scall,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1918,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* B[] are sbaij matrices */
1919 for (i=0; i<n; i++) {
1920 ierr = ISEqual(irow[i],icol[i],&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1920,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1921 if (!flg) {
1922 ierr = MatSeqSBAIJZeroOps_Private(*B[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1922,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1923 }
1924 }
1925 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1926}
1927
1928PetscErrorCode MatShift_MPISBAIJ(Mat Y,PetscScalar a)
1929{
1930 PetscErrorCode ierr;
1931 Mat_MPISBAIJ *maij = (Mat_MPISBAIJ*)Y->data;
1932 Mat_SeqSBAIJ *aij = (Mat_SeqSBAIJ*)maij->A->data;
1933
1934 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1934; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1935 if (!Y->preallocated) {
1936 ierr = MatMPISBAIJSetPreallocation(Y,Y->rmap->bs,1,NULL((void*)0),0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1936,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1937 } else if (!aij->nz) {
1938 PetscInt nonew = aij->nonew;
1939 ierr = MatSeqSBAIJSetPreallocation(maij->A,Y->rmap->bs,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1939,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1940 aij->nonew = nonew;
1941 }
1942 ierr = MatShift_Basic(Y,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1942,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1943 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1944}
1945
1946PetscErrorCode MatMissingDiagonal_MPISBAIJ(Mat A,PetscBool *missing,PetscInt *d)
1947{
1948 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
1949 PetscErrorCode ierr;
1950
1951 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1951; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1952 if (A->rmap->n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only works for square matrices")return PetscError(((MPI_Comm)0x44000001),1952,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Only works for square matrices")
;
1953 ierr = MatMissingDiagonal(a->A,missing,d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1953,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1954 if (d) {
1955 PetscInt rstart;
1956 ierr = MatGetOwnershipRange(A,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1956,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1957 *d += rstart/A->rmap->bs;
1958
1959 }
1960 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1961}
1962
1963PetscErrorCode MatGetDiagonalBlock_MPISBAIJ(Mat A,Mat *a)
1964{
1965 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 1965; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1966 *a = ((Mat_MPISBAIJ*)A->data)->A;
1967 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1968}
1969
1970/* -------------------------------------------------------------------*/
1971static struct _MatOps MatOps_Values = {MatSetValues_MPISBAIJ,
1972 MatGetRow_MPISBAIJ,
1973 MatRestoreRow_MPISBAIJ,
1974 MatMult_MPISBAIJ,
1975 /* 4*/ MatMultAdd_MPISBAIJ,
1976 MatMult_MPISBAIJ, /* transpose versions are same as non-transpose */
1977 MatMultAdd_MPISBAIJ,
1978 0,
1979 0,
1980 0,
1981 /* 10*/ 0,
1982 0,
1983 0,
1984 MatSOR_MPISBAIJ,
1985 MatTranspose_MPISBAIJ,
1986 /* 15*/ MatGetInfo_MPISBAIJ,
1987 MatEqual_MPISBAIJ,
1988 MatGetDiagonal_MPISBAIJ,
1989 MatDiagonalScale_MPISBAIJ,
1990 MatNorm_MPISBAIJ,
1991 /* 20*/ MatAssemblyBegin_MPISBAIJ,
1992 MatAssemblyEnd_MPISBAIJ,
1993 MatSetOption_MPISBAIJ,
1994 MatZeroEntries_MPISBAIJ,
1995 /* 24*/ 0,
1996 0,
1997 0,
1998 0,
1999 0,
2000 /* 29*/ MatSetUp_MPISBAIJ,
2001 0,
2002 0,
2003 MatGetDiagonalBlock_MPISBAIJ,
2004 0,
2005 /* 34*/ MatDuplicate_MPISBAIJ,
2006 0,
2007 0,
2008 0,
2009 0,
2010 /* 39*/ MatAXPY_MPISBAIJ,
2011 MatCreateSubMatrices_MPISBAIJ,
2012 MatIncreaseOverlap_MPISBAIJ,
2013 MatGetValues_MPISBAIJ,
2014 MatCopy_MPISBAIJ,
2015 /* 44*/ 0,
2016 MatScale_MPISBAIJ,
2017 MatShift_MPISBAIJ,
2018 0,
2019 0,
2020 /* 49*/ 0,
2021 0,
2022 0,
2023 0,
2024 0,
2025 /* 54*/ 0,
2026 0,
2027 MatSetUnfactored_MPISBAIJ,
2028 0,
2029 MatSetValuesBlocked_MPISBAIJ,
2030 /* 59*/ MatCreateSubMatrix_MPISBAIJ,
2031 0,
2032 0,
2033 0,
2034 0,
2035 /* 64*/ 0,
2036 0,
2037 0,
2038 0,
2039 0,
2040 /* 69*/ MatGetRowMaxAbs_MPISBAIJ,
2041 0,
2042 0,
2043 0,
2044 0,
2045 /* 74*/ 0,
2046 0,
2047 0,
2048 0,
2049 0,
2050 /* 79*/ 0,
2051 0,
2052 0,
2053 0,
2054 MatLoad_MPISBAIJ,
2055 /* 84*/ 0,
2056 0,
2057 0,
2058 0,
2059 0,
2060 /* 89*/ 0,
2061 0,
2062 0,
2063 0,
2064 0,
2065 /* 94*/ 0,
2066 0,
2067 0,
2068 0,
2069 0,
2070 /* 99*/ 0,
2071 0,
2072 0,
2073 0,
2074 0,
2075 /*104*/ 0,
2076 MatRealPart_MPISBAIJ,
2077 MatImaginaryPart_MPISBAIJ,
2078 MatGetRowUpperTriangular_MPISBAIJ,
2079 MatRestoreRowUpperTriangular_MPISBAIJ,
2080 /*109*/ 0,
2081 0,
2082 0,
2083 0,
2084 MatMissingDiagonal_MPISBAIJ,
2085 /*114*/ 0,
2086 0,
2087 0,
2088 0,
2089 0,
2090 /*119*/ 0,
2091 0,
2092 0,
2093 0,
2094 0,
2095 /*124*/ 0,
2096 0,
2097 0,
2098 0,
2099 0,
2100 /*129*/ 0,
2101 0,
2102 0,
2103 0,
2104 0,
2105 /*134*/ 0,
2106 0,
2107 0,
2108 0,
2109 0,
2110 /*139*/ MatSetBlockSizes_Default,
2111 0,
2112 0,
2113 0,
2114 0,
2115 /*144*/MatCreateMPIMatConcatenateSeqMat_MPISBAIJ
2116};
2117
2118PetscErrorCode MatMPISBAIJSetPreallocation_MPISBAIJ(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt *d_nnz,PetscInt o_nz,const PetscInt *o_nnz)
2119{
2120 Mat_MPISBAIJ *b;
2121 PetscErrorCode ierr;
2122 PetscInt i,mbs,Mbs;
2123 PetscMPIInt size;
2124
2125 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2125; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2126 ierr = MatSetBlockSize(B,PetscAbs(bs)(((bs) >= 0) ? (bs) : (-(bs))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2126,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2127 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2127,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2128 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2128,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2129 ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2129,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2130
2131 b = (Mat_MPISBAIJ*)B->data;
2132 mbs = B->rmap->n/bs;
2133 Mbs = B->rmap->N/bs;
2134 if (mbs*bs != B->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"No of local rows %D must be divisible by blocksize %D",B->rmap->N,bs)return PetscError(((MPI_Comm)0x44000001),2134,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,60,PETSC_ERROR_INITIAL,"No of local rows %D must be divisible by blocksize %D"
,B->rmap->N,bs)
;
2135
2136 B->rmap->bs = bs;
2137 b->bs2 = bs*bs;
2138 b->mbs = mbs;
2139 b->Mbs = Mbs;
2140 b->nbs = B->cmap->n/bs;
2141 b->Nbs = B->cmap->N/bs;
2142
2143 for (i=0; i<=b->size; i++) {
2144 b->rangebs[i] = B->rmap->range[i]/bs;
2145 }
2146 b->rstartbs = B->rmap->rstart/bs;
2147 b->rendbs = B->rmap->rend/bs;
2148
2149 b->cstartbs = B->cmap->rstart/bs;
2150 b->cendbs = B->cmap->rend/bs;
2151
2152#if defined(PETSC_USE_CTABLE1)
2153 ierr = PetscTableDestroy(&b->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2153,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2154#else
2155 ierr = PetscFree(b->colmap)((*PetscTrFree)((void*)(b->colmap),2155,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((b->colmap) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2155,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2156#endif
2157 ierr = PetscFree(b->garray)((*PetscTrFree)((void*)(b->garray),2157,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((b->garray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2157,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2158 ierr = VecDestroy(&b->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2158,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2159 ierr = VecScatterDestroy(&b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2159,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2160 ierr = VecDestroy(&b->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2160,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2161 ierr = VecDestroy(&b->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2161,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2162 ierr = VecDestroy(&b->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2162,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2163 ierr = VecDestroy(&b->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2163,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2164 ierr = VecDestroy(&b->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2165 ierr = VecScatterDestroy(&b->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2165,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2166
2167 /* Because the B will have been resized we simply destroy it and create a new one each time */
2168 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2168,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2169 ierr = MatDestroy(&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2169,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2170 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2170,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2171 ierr = MatSetSizes(b->B,B->rmap->n,size > 1 ? B->cmap->N : 0,B->rmap->n,size > 1 ? B->cmap->N : 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2171,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2172 ierr = MatSetType(b->B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2172,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2173 ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2173,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2174
2175 if (!B->preallocated) {
2176 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2176,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2177 ierr = MatSetSizes(b->A,B->rmap->n,B->cmap->n,B->rmap->n,B->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2177,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2178 ierr = MatSetType(b->A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2178,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2179 ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2179,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2180 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),bs,&B->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2180,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2181 }
2182
2183 ierr = MatSeqSBAIJSetPreallocation(b->A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2183,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2184 ierr = MatSeqBAIJSetPreallocation(b->B,bs,o_nz,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2184,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2185
2186 B->preallocated = PETSC_TRUE;
2187 B->was_assembled = PETSC_FALSE;
2188 B->assembled = PETSC_FALSE;
2189 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2190}
2191
2192PetscErrorCode MatMPISBAIJSetPreallocationCSR_MPISBAIJ(Mat B,PetscInt bs,const PetscInt ii[],const PetscInt jj[],const PetscScalar V[])
2193{
2194 PetscInt m,rstart,cstart,cend;
2195 PetscInt i,j,d,nz,bd, nz_max=0,*d_nnz=0,*o_nnz=0;
2196 const PetscInt *JJ =0;
2197 PetscScalar *values=0;
2198 PetscErrorCode ierr;
2199
2200 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2200; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2201 if (bs < 1) SETERRQ1(PetscObjectComm((PetscObject)B),PETSC_ERR_ARG_OUTOFRANGE,"Invalid block size specified, must be positive but it is %D",bs)return PetscError(PetscObjectComm((PetscObject)B),2201,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Invalid block size specified, must be positive but it is %D"
,bs)
;
2202 ierr = PetscLayoutSetBlockSize(B->rmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2202,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2203 ierr = PetscLayoutSetBlockSize(B->cmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2203,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2204 ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2204,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2205 ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2205,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2206 ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2206,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2207 m = B->rmap->n/bs;
2208 rstart = B->rmap->rstart/bs;
2209 cstart = B->cmap->rstart/bs;
2210 cend = B->cmap->rend/bs;
2211
2212 if (ii[0]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"ii[0] must be 0 but it is %D",ii[0])return PetscError(((MPI_Comm)0x44000001),2212,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"ii[0] must be 0 but it is %D",ii[0])
;
2213 ierr = PetscMalloc2(m,&d_nnz,m,&o_nnz)PetscMallocA(2,PETSC_FALSE,2213,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,(size_t)(m)*sizeof(**(&d_nnz)),(&d_nnz),(size_t)(m)*
sizeof(**(&o_nnz)),(&o_nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2213,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2214 for (i=0; i<m; i++) {
2215 nz = ii[i+1] - ii[i];
2216 if (nz < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Local row %D has a negative number of columns %D",i,nz)return PetscError(((MPI_Comm)0x44000001),2216,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"Local row %D has a negative number of columns %D"
,i,nz)
;
2217 /* count the ones on the diagonal and above, split into diagonal and off diagonal portions. */
2218 JJ = jj + ii[i];
2219 bd = 0;
2220 for (j=0; j<nz; j++) {
2221 if (*JJ >= i + rstart) break;
2222 JJ++;
2223 bd++;
2224 }
2225 d = 0;
2226 for (; j<nz; j++) {
2227 if (*JJ++ >= cend) break;
2228 d++;
2229 }
2230 d_nnz[i] = d;
2231 o_nnz[i] = nz - d - bd;
2232 nz = nz - bd;
2233 nz_max = PetscMax(nz_max,nz)(((nz_max)<(nz)) ? (nz) : (nz_max));
2234 }
2235 ierr = MatMPISBAIJSetPreallocation(B,bs,0,d_nnz,0,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2235,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2236 ierr = PetscFree2(d_nnz,o_nnz)PetscFreeA(2,2236,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(d_nnz),&(o_nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2236,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2237
2238 values = (PetscScalar*)V;
2239 if (!values) {
2240 ierr = PetscCalloc1(bs*bs*nz_max,&values)PetscMallocA(1,PETSC_TRUE,2240,__func__,"/sandbox/petsc/petsc.next/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),2240,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2241 }
2242 for (i=0; i<m; i++) {
2243 PetscInt row = i + rstart;
2244 PetscInt ncols = ii[i+1] - ii[i];
2245 const PetscInt *icols = jj + ii[i];
2246 const PetscScalar *svals = values + (V ? (bs*bs*ii[i]) : 0);
2247 if (bs == 1) {
2248 ierr = MatSetValuesBlocked_MPISBAIJ(B,1,&row,ncols,icols,svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2248,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2249 } else {
2250 for (j=0; j<ncols; j++) {
2251 const PetscScalar *svals = values + (V ? (bs*bs*(ii[i]+j)) : 0);
2252 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),2252,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2253 }
2254 }
2255 }
2256
2257 if (!V) { ierr = PetscFree(values)((*PetscTrFree)((void*)(values),2257,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2257,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
2258 ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2258,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2259 ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2259,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2260 ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2260,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2261 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2262}
2263
2264/*MC
2265 MATMPISBAIJ - MATMPISBAIJ = "mpisbaij" - A matrix type to be used for distributed symmetric sparse block matrices,
2266 based on block compressed sparse row format. Only the upper triangular portion of the "diagonal" portion of
2267 the matrix is stored.
2268
2269 For complex numbers by default this matrix is symmetric, NOT Hermitian symmetric. To make it Hermitian symmetric you
2270 can call MatSetOption(Mat, MAT_HERMITIAN);
2271
2272 Options Database Keys:
2273. -mat_type mpisbaij - sets the matrix type to "mpisbaij" during a call to MatSetFromOptions()
2274
2275 Level: beginner
2276
2277.seealso: MatCreateMPISBAIJ
2278M*/
2279
2280PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_MPISBAIJ(Mat B)
2281{
2282 Mat_MPISBAIJ *b;
2283 PetscErrorCode ierr;
2284 PetscBool flg = PETSC_FALSE;
2285
2286 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2286; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2287 ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,2287,__func__,"/sandbox/petsc/petsc.next/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),2287,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2288 B->data = (void*)b;
2289 ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2289,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2290
2291 B->ops->destroy = MatDestroy_MPISBAIJ;
2292 B->ops->view = MatView_MPISBAIJ;
2293 B->assembled = PETSC_FALSE;
2294 B->insertmode = NOT_SET_VALUES;
2295
2296 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)B),&b->rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2296,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2297 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&b->size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2297,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2298
2299 /* build local table of row and column ownerships */
2300 ierr = PetscMalloc1(b->size+2,&b->rangebs)PetscMallocA(1,PETSC_FALSE,2300,__func__,"/sandbox/petsc/petsc.next/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),2300,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2301
2302 /* build cache for off array entries formed */
2303 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),1,&B->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2303,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2304
2305 b->donotstash = PETSC_FALSE;
2306 b->colmap = NULL((void*)0);
2307 b->garray = NULL((void*)0);
2308 b->roworiented = PETSC_TRUE;
2309
2310 /* stuff used in block assembly */
2311 b->barray = 0;
2312
2313 /* stuff used for matrix vector multiply */
2314 b->lvec = 0;
2315 b->Mvctx = 0;
2316 b->slvec0 = 0;
2317 b->slvec0b = 0;
2318 b->slvec1 = 0;
2319 b->slvec1a = 0;
2320 b->slvec1b = 0;
2321 b->sMvctx = 0;
2322
2323 /* stuff for MatGetRow() */
2324 b->rowindices = 0;
2325 b->rowvalues = 0;
2326 b->getrowactive = PETSC_FALSE;
2327
2328 /* hash table stuff */
2329 b->ht = 0;
2330 b->hd = 0;
2331 b->ht_size = 0;
2332 b->ht_flag = PETSC_FALSE;
2333 b->ht_fact = 0;
2334 b->ht_total_ct = 0;
2335 b->ht_insert_ct = 0;
2336
2337 /* stuff for MatCreateSubMatrices_MPIBAIJ_local() */
2338 b->ijonly = PETSC_FALSE;
2339
2340 b->in_loc = 0;
2341 b->v_loc = 0;
2342 b->n_loc = 0;
2343
2344 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),2344,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2345 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),2345,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2346 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),2346,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2347 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),2347,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2348#if defined(PETSC_HAVE_ELEMENTAL)
2349 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),2349,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2350#endif
2351 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),2351,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2352 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),2352,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2353
2354 B->symmetric = PETSC_TRUE;
2355 B->structurally_symmetric = PETSC_TRUE;
2356 B->symmetric_set = PETSC_TRUE;
2357 B->structurally_symmetric_set = PETSC_TRUE;
2358 B->symmetric_eternal = PETSC_TRUE;
2359
2360 B->hermitian = PETSC_FALSE;
2361 B->hermitian_set = PETSC_FALSE;
2362
2363 ierr = PetscObjectChangeTypeName((PetscObject)B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2363,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2364 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),2364,__func__,"/sandbox/petsc/petsc.next/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),2364,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2365 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),2365,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2366 if (flg) {
2367 PetscReal fact = 1.39;
2368 ierr = MatSetOption(B,MAT_USE_HASH_TABLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2368,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2369 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),2369,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2370 if (fact <= 1.0) fact = 1.39;
2371 ierr = MatMPIBAIJSetHashTableFactor(B,fact);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2371,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2372 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),2372,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2373 }
2374 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2374,__func__,"/sandbox/petsc/petsc.next/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),2374,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2375 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2376}
2377
2378/*MC
2379 MATSBAIJ - MATSBAIJ = "sbaij" - A matrix type to be used for symmetric block sparse matrices.
2380
2381 This matrix type is identical to MATSEQSBAIJ when constructed with a single process communicator,
2382 and MATMPISBAIJ otherwise.
2383
2384 Options Database Keys:
2385. -mat_type sbaij - sets the matrix type to "sbaij" during a call to MatSetFromOptions()
2386
2387 Level: beginner
2388
2389.seealso: MatCreateMPISBAIJ,MATSEQSBAIJ,MATMPISBAIJ
2390M*/
2391
2392/*@C
2393 MatMPISBAIJSetPreallocation - For good matrix assembly performance
2394 the user should preallocate the matrix storage by setting the parameters
2395 d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately,
2396 performance can be increased by more than a factor of 50.
2397
2398 Collective on Mat
2399
2400 Input Parameters:
2401+ B - the matrix
2402. bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row
2403 blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()
2404. d_nz - number of block nonzeros per block row in diagonal portion of local
2405 submatrix (same for all local rows)
2406. d_nnz - array containing the number of block nonzeros in the various block rows
2407 in the upper triangular and diagonal part of the in diagonal portion of the local
2408 (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room
2409 for the diagonal entry and set a value even if it is zero.
2410. o_nz - number of block nonzeros per block row in the off-diagonal portion of local
2411 submatrix (same for all local rows).
2412- o_nnz - array containing the number of nonzeros in the various block rows of the
2413 off-diagonal portion of the local submatrix that is right of the diagonal
2414 (possibly different for each block row) or NULL.
2415
2416
2417 Options Database Keys:
2418+ -mat_no_unroll - uses code that does not unroll the loops in the
2419 block calculations (much slower)
2420- -mat_block_size - size of the blocks to use
2421
2422 Notes:
2423
2424 If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor
2425 than it must be used on all processors that share the object for that argument.
2426
2427 If the *_nnz parameter is given then the *_nz parameter is ignored
2428
2429 Storage Information:
2430 For a square global matrix we define each processor's diagonal portion
2431 to be its local rows and the corresponding columns (a square submatrix);
2432 each processor's off-diagonal portion encompasses the remainder of the
2433 local matrix (a rectangular submatrix).
2434
2435 The user can specify preallocated storage for the diagonal part of
2436 the local submatrix with either d_nz or d_nnz (not both). Set
2437 d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic
2438 memory allocation. Likewise, specify preallocated storage for the
2439 off-diagonal part of the local submatrix with o_nz or o_nnz (not both).
2440
2441 You can call MatGetInfo() to get information on how effective the preallocation was;
2442 for example the fields mallocs,nz_allocated,nz_used,nz_unneeded;
2443 You can also run with the option -info and look for messages with the string
2444 malloc in them to see if additional memory allocation was needed.
2445
2446 Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In
2447 the figure below we depict these three local rows and all columns (0-11).
2448
2449.vb
2450 0 1 2 3 4 5 6 7 8 9 10 11
2451 --------------------------
2452 row 3 |. . . d d d o o o o o o
2453 row 4 |. . . d d d o o o o o o
2454 row 5 |. . . d d d o o o o o o
2455 --------------------------
2456.ve
2457
2458 Thus, any entries in the d locations are stored in the d (diagonal)
2459 submatrix, and any entries in the o locations are stored in the
2460 o (off-diagonal) submatrix. Note that the d matrix is stored in
2461 MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format.
2462
2463 Now d_nz should indicate the number of block nonzeros per row in the upper triangular
2464 plus the diagonal part of the d matrix,
2465 and o_nz should indicate the number of block nonzeros per row in the o matrix
2466
2467 In general, for PDE problems in which most nonzeros are near the diagonal,
2468 one expects d_nz >> o_nz. For large problems you MUST preallocate memory
2469 or you will get TERRIBLE performance; see the users' manual chapter on
2470 matrices.
2471
2472 Level: intermediate
2473
2474.seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), PetscSplitOwnership()
2475@*/
2476PetscErrorCode MatMPISBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[])
2477{
2478 PetscErrorCode ierr;
2479
2480 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2480; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2481 PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),2481,__func__
,"/sandbox/petsc/petsc.next/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),2481,__func__,"/sandbox/petsc/petsc.next/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),2481,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2481,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
2482 PetscValidType(B,1)do { if (!((PetscObject)B)->type_name) return PetscError((
(MPI_Comm)0x44000001),2482,__func__,"/sandbox/petsc/petsc.next/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)
;
2483 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,2483,__func__,"/sandbox/petsc/petsc.next/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),2483,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)B),2483,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
2484 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),2484,__func__,"/sandbox/petsc/petsc.next/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),2484
,__func__,"/sandbox/petsc/petsc.next/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),2484,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2485 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2486}
2487
2488/*@C
2489 MatCreateSBAIJ - Creates a sparse parallel matrix in symmetric block AIJ format
2490 (block compressed row). For good matrix assembly performance
2491 the user should preallocate the matrix storage by setting the parameters
2492 d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately,
2493 performance can be increased by more than a factor of 50.
2494
2495 Collective
2496
2497 Input Parameters:
2498+ comm - MPI communicator
2499. bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row
2500 blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs()
2501. m - number of local rows (or PETSC_DECIDE to have calculated if M is given)
2502 This value should be the same as the local size used in creating the
2503 y vector for the matrix-vector product y = Ax.
2504. n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
2505 This value should be the same as the local size used in creating the
2506 x vector for the matrix-vector product y = Ax.
2507. M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
2508. N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
2509. d_nz - number of block nonzeros per block row in diagonal portion of local
2510 submatrix (same for all local rows)
2511. d_nnz - array containing the number of block nonzeros in the various block rows
2512 in the upper triangular portion of the in diagonal portion of the local
2513 (possibly different for each block block row) or NULL.
2514 If you plan to factor the matrix you must leave room for the diagonal entry and
2515 set its value even if it is zero.
2516. o_nz - number of block nonzeros per block row in the off-diagonal portion of local
2517 submatrix (same for all local rows).
2518- o_nnz - array containing the number of nonzeros in the various block rows of the
2519 off-diagonal portion of the local submatrix (possibly different for
2520 each block row) or NULL.
2521
2522 Output Parameter:
2523. A - the matrix
2524
2525 Options Database Keys:
2526+ -mat_no_unroll - uses code that does not unroll the loops in the
2527 block calculations (much slower)
2528. -mat_block_size - size of the blocks to use
2529- -mat_mpi - use the parallel matrix data structures even on one processor
2530 (defaults to using SeqBAIJ format on one processor)
2531
2532 It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(),
2533 MatXXXXSetPreallocation() paradigm instead of this routine directly.
2534 [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation]
2535
2536 Notes:
2537 The number of rows and columns must be divisible by blocksize.
2538 This matrix type does not support complex Hermitian operation.
2539
2540 The user MUST specify either the local or global matrix dimensions
2541 (possibly both).
2542
2543 If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor
2544 than it must be used on all processors that share the object for that argument.
2545
2546 If the *_nnz parameter is given then the *_nz parameter is ignored
2547
2548 Storage Information:
2549 For a square global matrix we define each processor's diagonal portion
2550 to be its local rows and the corresponding columns (a square submatrix);
2551 each processor's off-diagonal portion encompasses the remainder of the
2552 local matrix (a rectangular submatrix).
2553
2554 The user can specify preallocated storage for the diagonal part of
2555 the local submatrix with either d_nz or d_nnz (not both). Set
2556 d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic
2557 memory allocation. Likewise, specify preallocated storage for the
2558 off-diagonal part of the local submatrix with o_nz or o_nnz (not both).
2559
2560 Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In
2561 the figure below we depict these three local rows and all columns (0-11).
2562
2563.vb
2564 0 1 2 3 4 5 6 7 8 9 10 11
2565 --------------------------
2566 row 3 |. . . d d d o o o o o o
2567 row 4 |. . . d d d o o o o o o
2568 row 5 |. . . d d d o o o o o o
2569 --------------------------
2570.ve
2571
2572 Thus, any entries in the d locations are stored in the d (diagonal)
2573 submatrix, and any entries in the o locations are stored in the
2574 o (off-diagonal) submatrix. Note that the d matrix is stored in
2575 MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format.
2576
2577 Now d_nz should indicate the number of block nonzeros per row in the upper triangular
2578 plus the diagonal part of the d matrix,
2579 and o_nz should indicate the number of block nonzeros per row in the o matrix.
2580 In general, for PDE problems in which most nonzeros are near the diagonal,
2581 one expects d_nz >> o_nz. For large problems you MUST preallocate memory
2582 or you will get TERRIBLE performance; see the users' manual chapter on
2583 matrices.
2584
2585 Level: intermediate
2586
2587.seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ()
2588@*/
2589
2590PetscErrorCode 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)
2591{
2592 PetscErrorCode ierr;
2593 PetscMPIInt size;
2594
2595 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2595; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2596 ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2596,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2597 ierr = MatSetSizes(*A,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2597,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2598 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2598,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2599 if (size > 1) {
2600 ierr = MatSetType(*A,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2600,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2601 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),2601,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2602 } else {
2603 ierr = MatSetType(*A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2603,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2604 ierr = MatSeqSBAIJSetPreallocation(*A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2604,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2605 }
2606 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2607}
2608
2609
2610static PetscErrorCode MatDuplicate_MPISBAIJ(Mat matin,MatDuplicateOption cpvalues,Mat *newmat)
2611{
2612 Mat mat;
2613 Mat_MPISBAIJ *a,*oldmat = (Mat_MPISBAIJ*)matin->data;
2614 PetscErrorCode ierr;
2615 PetscInt len=0,nt,bs=matin->rmap->bs,mbs=oldmat->mbs;
2616 PetscScalar *array;
2617
2618 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2618; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2619 *newmat = 0;
2620
2621 ierr = MatCreate(PetscObjectComm((PetscObject)matin),&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2621,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2622 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),2622,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2623 ierr = MatSetType(mat,((PetscObject)matin)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2623,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2624 ierr = PetscLayoutReference(matin->rmap,&mat->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2624,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2625 ierr = PetscLayoutReference(matin->cmap,&mat->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2625,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2626
2627 mat->factortype = matin->factortype;
2628 mat->preallocated = PETSC_TRUE;
2629 mat->assembled = PETSC_TRUE;
2630 mat->insertmode = NOT_SET_VALUES;
2631
2632 a = (Mat_MPISBAIJ*)mat->data;
2633 a->bs2 = oldmat->bs2;
2634 a->mbs = oldmat->mbs;
2635 a->nbs = oldmat->nbs;
2636 a->Mbs = oldmat->Mbs;
2637 a->Nbs = oldmat->Nbs;
2638
2639 a->size = oldmat->size;
2640 a->rank = oldmat->rank;
2641 a->donotstash = oldmat->donotstash;
2642 a->roworiented = oldmat->roworiented;
2643 a->rowindices = 0;
2644 a->rowvalues = 0;
2645 a->getrowactive = PETSC_FALSE;
2646 a->barray = 0;
2647 a->rstartbs = oldmat->rstartbs;
2648 a->rendbs = oldmat->rendbs;
2649 a->cstartbs = oldmat->cstartbs;
2650 a->cendbs = oldmat->cendbs;
2651
2652 /* hash table stuff */
2653 a->ht = 0;
2654 a->hd = 0;
2655 a->ht_size = 0;
2656 a->ht_flag = oldmat->ht_flag;
2657 a->ht_fact = oldmat->ht_fact;
2658 a->ht_total_ct = 0;
2659 a->ht_insert_ct = 0;
2660
2661 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),2661,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2662 if (oldmat->colmap) {
2663#if defined(PETSC_USE_CTABLE1)
2664 ierr = PetscTableCreateCopy(oldmat->colmap,&a->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2664,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2665#else
2666 ierr = PetscMalloc1(a->Nbs,&a->colmap)PetscMallocA(1,PETSC_FALSE,2666,__func__,"/sandbox/petsc/petsc.next/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),2666,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2667 ierr = PetscLogObjectMemory((PetscObject)mat,(a->Nbs)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2667,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2668 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),2668,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2669#endif
2670 } else a->colmap = 0;
2671
2672 if (oldmat->garray && (len = ((Mat_SeqBAIJ*)(oldmat->B->data))->nbs)) {
2673 ierr = PetscMalloc1(len,&a->garray)PetscMallocA(1,PETSC_FALSE,2673,__func__,"/sandbox/petsc/petsc.next/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),2673,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2674 ierr = PetscLogObjectMemory((PetscObject)mat,len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2674,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2675 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),2675,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2676 } else a->garray = 0;
2677
2678 ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)matin),matin->rmap->bs,&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2678,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2679 ierr = VecDuplicate(oldmat->lvec,&a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2679,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2680 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2680,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2681 ierr = VecScatterCopy(oldmat->Mvctx,&a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2681,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2682 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2682,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2683
2684 ierr = VecDuplicate(oldmat->slvec0,&a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2684,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2685 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2685,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2686 ierr = VecDuplicate(oldmat->slvec1,&a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2686,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2687 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2687,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2688
2689 ierr = VecGetLocalSize(a->slvec1,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2689,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2690 ierr = VecGetArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2690,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2691 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),2691,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2692 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),2692,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2693 ierr = VecRestoreArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2693,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2694 ierr = VecGetArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2694,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2695 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),2695,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2696 ierr = VecRestoreArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2696,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2697 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2697,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2698 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2698,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2699 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2699,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2700 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2700,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2701 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2701,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2702
2703 /* ierr = VecScatterCopy(oldmat->sMvctx,&a->sMvctx); - not written yet, replaced by the lazy trick: */
2704 ierr = PetscObjectReference((PetscObject)oldmat->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2704,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2705 a->sMvctx = oldmat->sMvctx;
2706 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2706,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2707
2708 ierr = MatDuplicate(oldmat->A,cpvalues,&a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2708,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2709 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2709,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2710 ierr = MatDuplicate(oldmat->B,cpvalues,&a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2710,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2711 ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2711,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2712 ierr = PetscFunctionListDuplicate(((PetscObject)matin)->qlist,&((PetscObject)mat)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2712,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2713 *newmat = mat;
2714 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2715}
2716
2717PetscErrorCode MatLoad_MPISBAIJ(Mat newmat,PetscViewer viewer)
2718{
2719 PetscErrorCode ierr;
2720 PetscInt i,nz,j,rstart,rend;
2721 PetscScalar *vals,*buf;
2722 MPI_Comm comm;
2723 MPI_Status status;
2724 PetscMPIInt rank,size,tag = ((PetscObject)viewer)->tag,*sndcounts = 0,*browners,maxnz,*rowners,mmbs;
2725 PetscInt header[4],*rowlengths = 0,M,N,m,*cols,*locrowlens;
2726 PetscInt *procsnz = 0,jj,*mycols,*ibuf;
2727 PetscInt bs = newmat->rmap->bs,Mbs,mbs,extra_rows;
2728 PetscInt *dlens,*odlens,*mask,*masked1,*masked2,rowcount,odcount;
2729 PetscInt dcount,kmax,k,nzcount,tmp;
2730 int fd;
2731 PetscBool isbinary;
2732
2733 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2733; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2734 ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2734,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2735 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),2735,__func__
,"/sandbox/petsc/petsc.next/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)
;
2736
2737 /* force binary viewer to load .info file if it has not yet done so */
2738 ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2738,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2739 ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2739,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2740 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),2740
,__func__,"/sandbox/petsc/petsc.next/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),2740,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2741 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),2741,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2742 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2742,__func__,"/sandbox/petsc/petsc.next/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),2742,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2743 if (bs < 0) bs = 1;
2744
2745 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2745,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2746 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2746,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2747 ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2747,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2748 if (!rank) {
2749 ierr = PetscBinaryRead(fd,(char*)header,4,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2749,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2750 if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object")return PetscError(((MPI_Comm)0x44000001),2750,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"not matrix object")
;
2751 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),2751,__func__
,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"Matrix stored in special format, cannot load as MPISBAIJ"
)
;
2752 }
2753
2754 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),2754,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2755 M = header[1];
2756 N = header[2];
2757
2758 /* If global sizes are set, check if they are consistent with that given in the file */
2759 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),2759,__func__,"/sandbox/petsc/petsc.next/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)
;
2760 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),2760,__func__,"/sandbox/petsc/petsc.next/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)
;
2761
2762 if (M != N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Can only do square matrices")return PetscError(((MPI_Comm)0x44000001),2762,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Can only do square matrices")
;
2763
2764 /*
2765 This code adds extra rows to make sure the number of rows is
2766 divisible by the blocksize
2767 */
2768 Mbs = M/bs;
2769 extra_rows = bs - M + bs*(Mbs);
2770 if (extra_rows == bs) extra_rows = 0;
2771 else Mbs++;
2772 if (extra_rows &&!rank) {
2773 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),2773,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2774 }
2775
2776 /* determine ownership of all rows */
2777 if (newmat->rmap->n < 0) { /* PETSC_DECIDE */
2778 mbs = Mbs/size + ((Mbs % size) > rank);
2779 m = mbs*bs;
2780 } else { /* User Set */
2781 m = newmat->rmap->n;
2782 mbs = m/bs;
2783 }
2784 ierr = PetscMalloc2(size+1,&rowners,size+1,&browners)PetscMallocA(2,PETSC_FALSE,2784,__func__,"/sandbox/petsc/petsc.next/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),2784,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2785 ierr = PetscMPIIntCast(mbs,&mmbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2785,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2786 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),2786,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2787 rowners[0] = 0;
2788 for (i=2; i<=size; i++) rowners[i] += rowners[i-1];
2789 for (i=0; i<=size; i++) browners[i] = rowners[i]*bs;
2790 rstart = rowners[rank];
2791 rend = rowners[rank+1];
2792
2793 /* distribute row lengths to all processors */
2794 ierr = PetscMalloc1((rend-rstart)*bs,&locrowlens)PetscMallocA(1,PETSC_FALSE,2794,__func__,"/sandbox/petsc/petsc.next/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),2794,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2795 if (!rank) {
2796 ierr = PetscMalloc1(M+extra_rows,&rowlengths)PetscMallocA(1,PETSC_FALSE,2796,__func__,"/sandbox/petsc/petsc.next/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),2796,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2797 ierr = PetscBinaryRead(fd,rowlengths,M,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2797,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2798 for (i=0; i<extra_rows; i++) rowlengths[M+i] = 1;
2799 ierr = PetscMalloc1(size,&sndcounts)PetscMallocA(1,PETSC_FALSE,2799,__func__,"/sandbox/petsc/petsc.next/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),2799,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2800 for (i=0; i<size; i++) sndcounts[i] = browners[i+1] - browners[i];
2801 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),2801,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2802 ierr = PetscFree(sndcounts)((*PetscTrFree)((void*)(sndcounts),2802,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((sndcounts) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2802,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2803 } else {
2804 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),2804,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2805 }
2806
2807 if (!rank) { /* procs[0] */
2808 /* calculate the number of nonzeros on each processor */
2809 ierr = PetscCalloc1(size,&procsnz)PetscMallocA(1,PETSC_TRUE,2809,__func__,"/sandbox/petsc/petsc.next/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),2809,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2810 for (i=0; i<size; i++) {
2811 for (j=rowners[i]*bs; j< rowners[i+1]*bs; j++) {
2812 procsnz[i] += rowlengths[j];
2813 }
2814 }
2815 ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),2815,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((rowlengths) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2815,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2816
2817 /* determine max buffer needed and allocate it */
2818 maxnz = 0;
2819 for (i=0; i<size; i++) {
2820 maxnz = PetscMax(maxnz,procsnz[i])(((maxnz)<(procsnz[i])) ? (procsnz[i]) : (maxnz));
2821 }
2822 ierr = PetscMalloc1(maxnz,&cols)PetscMallocA(1,PETSC_FALSE,2822,__func__,"/sandbox/petsc/petsc.next/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),2822,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2823
2824 /* read in my part of the matrix column indices */
2825 nz = procsnz[0];
2826 ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2826,__func__,"/sandbox/petsc/petsc.next/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),2826,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2827 mycols = ibuf;
2828 if (size == 1) nz -= extra_rows;
2829 ierr = PetscBinaryRead(fd,mycols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2829,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2830 if (size == 1) {
2831 for (i=0; i< extra_rows; i++) mycols[nz+i] = M+i;
2832 }
2833
2834 /* read in every ones (except the last) and ship off */
2835 for (i=1; i<size-1; i++) {
2836 nz = procsnz[i];
2837 ierr = PetscBinaryRead(fd,cols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2837,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2838 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),2838,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2839 }
2840 /* read in the stuff for the last proc */
2841 if (size != 1) {
2842 nz = procsnz[size-1] - extra_rows; /* the extra rows are not on the disk */
2843 ierr = PetscBinaryRead(fd,cols,nz,NULL((void*)0),PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2843,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2844 for (i=0; i<extra_rows; i++) cols[nz+i] = M+i;
2845 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),2845,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2846 }
2847 ierr = PetscFree(cols)((*PetscTrFree)((void*)(cols),2847,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((cols) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2847,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2848 } else { /* procs[i], i>0 */
2849 /* determine buffer space needed for message */
2850 nz = 0;
2851 for (i=0; i<m; i++) nz += locrowlens[i];
2852 ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2852,__func__,"/sandbox/petsc/petsc.next/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),2852,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2853 mycols = ibuf;
2854 /* receive message of column indices*/
2855 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),2855,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2856 ierr = MPI_Get_count(&status,MPIU_INT((MPI_Datatype)0x4c000405),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2856,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2857 if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2857,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"something is wrong with file")
;
2858 }
2859
2860 /* loop over local rows, determining number of off diagonal entries */
2861 ierr = PetscMalloc2(rend-rstart,&dlens,rend-rstart,&odlens)PetscMallocA(2,PETSC_FALSE,2861,__func__,"/sandbox/petsc/petsc.next/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),2861,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2862 ierr = PetscCalloc3(Mbs,&mask,Mbs,&masked1,Mbs,&masked2)PetscMallocA(3,PETSC_TRUE,2862,__func__,"/sandbox/petsc/petsc.next/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),2862,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2863 rowcount = 0;
2864 nzcount = 0;
2865 for (i=0; i<mbs; i++) {
2866 dcount = 0;
2867 odcount = 0;
2868 for (j=0; j<bs; j++) {
2869 kmax = locrowlens[rowcount];
2870 for (k=0; k<kmax; k++) {
2871 tmp = mycols[nzcount++]/bs; /* block col. index */
2872 if (!mask[tmp]) {
2873 mask[tmp] = 1;
2874 if (tmp < rstart || tmp >= rend) masked2[odcount++] = tmp; /* entry in off-diag portion */
2875 else masked1[dcount++] = tmp; /* entry in diag portion */
2876 }
2877 }
2878 rowcount++;
2879 }
2880
2881 dlens[i] = dcount; /* d_nzz[i] */
2882 odlens[i] = odcount; /* o_nzz[i] */
2883
2884 /* zero out the mask elements we set */
2885 for (j=0; j<dcount; j++) mask[masked1[j]] = 0;
2886 for (j=0; j<odcount; j++) mask[masked2[j]] = 0;
2887 }
2888 ierr = MatSetSizes(newmat,m,m,M+extra_rows,N+extra_rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2888,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2889 ierr = MatMPISBAIJSetPreallocation(newmat,bs,0,dlens,0,odlens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2889,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2890 ierr = MatSetOption(newmat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2890,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2891
2892 if (!rank) {
2893 ierr = PetscMalloc1(maxnz,&buf)PetscMallocA(1,PETSC_FALSE,2893,__func__,"/sandbox/petsc/petsc.next/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),2893,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2894 /* read in my part of the matrix numerical values */
2895 nz = procsnz[0];
2896 vals = buf;
2897 mycols = ibuf;
2898 if (size == 1) nz -= extra_rows;
2899 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2899,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2900 if (size == 1) {
2901 for (i=0; i< extra_rows; i++) vals[nz+i] = 1.0;
2902 }
2903
2904 /* insert into matrix */
2905 jj = rstart*bs;
2906 for (i=0; i<m; i++) {
2907 ierr = MatSetValues(newmat,1,&jj,locrowlens[i],mycols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2907,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2908 mycols += locrowlens[i];
2909 vals += locrowlens[i];
2910 jj++;
2911 }
2912
2913 /* read in other processors (except the last one) and ship out */
2914 for (i=1; i<size-1; i++) {
2915 nz = procsnz[i];
2916 vals = buf;
2917 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2917,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2918 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),2918,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2919 }
2920 /* the last proc */
2921 if (size != 1) {
2922 nz = procsnz[i] - extra_rows;
2923 vals = buf;
2924 ierr = PetscBinaryRead(fd,vals,nz,NULL((void*)0),PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2924,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2925 for (i=0; i<extra_rows; i++) vals[nz+i] = 1.0;
2926 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),2926,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2927 }
2928 ierr = PetscFree(procsnz)((*PetscTrFree)((void*)(procsnz),2928,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((procsnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2928,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2929
2930 } else {
2931 /* receive numeric values */
2932 ierr = PetscMalloc1(nz,&buf)PetscMallocA(1,PETSC_FALSE,2932,__func__,"/sandbox/petsc/petsc.next/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),2932,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2933
2934 /* receive message of values*/
2935 vals = buf;
2936 mycols = ibuf;
2937 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),2937,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2938 ierr = MPI_Get_count(&status,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2938,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2939 if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2939,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,79,PETSC_ERROR_INITIAL,"something is wrong with file")
;
2940
2941 /* insert into matrix */
2942 jj = rstart*bs;
2943 for (i=0; i<m; i++) {
2944 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),2944,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2945 mycols += locrowlens[i];
2946 vals += locrowlens[i];
2947 jj++;
2948 }
2949 }
2950
2951 ierr = PetscFree(locrowlens)((*PetscTrFree)((void*)(locrowlens),2951,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((locrowlens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2951,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2952 ierr = PetscFree(buf)((*PetscTrFree)((void*)(buf),2952,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((buf) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2952,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2953 ierr = PetscFree(ibuf)((*PetscTrFree)((void*)(ibuf),2953,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((ibuf) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2953,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2954 ierr = PetscFree2(rowners,browners)PetscFreeA(2,2954,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(rowners),&(browners))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2954,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2955 ierr = PetscFree2(dlens,odlens)PetscFreeA(2,2955,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(dlens),&(odlens))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2955,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2956 ierr = PetscFree3(mask,masked1,masked2)PetscFreeA(3,2956,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(mask),&(masked1),&(masked2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2956,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2957 ierr = MatAssemblyBegin(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2957,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2958 ierr = MatAssemblyEnd(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2958,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2959 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2960}
2961
2962/*XXXXX@
2963 MatMPISBAIJSetHashTableFactor - Sets the factor required to compute the size of the HashTable.
2964
2965 Input Parameters:
2966. mat - the matrix
2967. fact - factor
2968
2969 Not Collective on Mat, each process can have a different hash factor
2970
2971 Level: advanced
2972
2973 Notes:
2974 This can also be set by the command line option: -mat_use_hash_table fact
2975
2976.seealso: MatSetOption()
2977@XXXXX*/
2978
2979
2980PetscErrorCode MatGetRowMaxAbs_MPISBAIJ(Mat A,Vec v,PetscInt idx[])
2981{
2982 Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data;
2983 Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)(a->B)->data;
2984 PetscReal atmp;
2985 PetscReal *work,*svalues,*rvalues;
2986 PetscErrorCode ierr;
2987 PetscInt i,bs,mbs,*bi,*bj,brow,j,ncols,krow,kcol,col,row,Mbs,bcol;
2988 PetscMPIInt rank,size;
2989 PetscInt *rowners_bs,dest,count,source;
2990 PetscScalar *va;
2991 MatScalar *ba;
2992 MPI_Status stat;
2993
2994 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 2994; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2995 if (idx) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Send email to [email protected]")return PetscError(((MPI_Comm)0x44000001),2995,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"Send email to [email protected]"
)
;
2996 ierr = MatGetRowMaxAbs(a->A,v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2996,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2997 ierr = VecGetArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2997,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2998
2999 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2999,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3000 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3000,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3001
3002 bs = A->rmap->bs;
3003 mbs = a->mbs;
3004 Mbs = a->Mbs;
3005 ba = b->a;
3006 bi = b->i;
3007 bj = b->j;
3008
3009 /* find ownerships */
3010 rowners_bs = A->rmap->range;
3011
3012 /* each proc creates an array to be distributed */
3013 ierr = PetscCalloc1(bs*Mbs,&work)PetscMallocA(1,PETSC_TRUE,3013,__func__,"/sandbox/petsc/petsc.next/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),3013,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3014
3015 /* row_max for B */
3016 if (rank != size-1) {
3017 for (i=0; i<mbs; i++) {
3018 ncols = bi[1] - bi[0]; bi++;
3019 brow = bs*i;
3020 for (j=0; j<ncols; j++) {
3021 bcol = bs*(*bj);
3022 for (kcol=0; kcol<bs; kcol++) {
3023 col = bcol + kcol; /* local col index */
3024 col += rowners_bs[rank+1]; /* global col index */
3025 for (krow=0; krow<bs; krow++) {
3026 atmp = PetscAbsScalar(*ba); ba++;
3027 row = brow + krow; /* local row index */
3028 if (PetscRealPart(va[row])(va[row]) < atmp) va[row] = atmp;
3029 if (work[col] < atmp) work[col] = atmp;
3030 }
3031 }
3032 bj++;
3033 }
3034 }
3035
3036 /* send values to its owners */
3037 for (dest=rank+1; dest<size; dest++) {
3038 svalues = work + rowners_bs[dest];
3039 count = rowners_bs[dest+1]-rowners_bs[dest];
3040 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),3040,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3041 }
3042 }
3043
3044 /* receive values */
3045 if (rank) {
3046 rvalues = work;
3047 count = rowners_bs[rank+1]-rowners_bs[rank];
3048 for (source=0; source<rank; source++) {
3049 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),3049,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3050 /* process values */
3051 for (i=0; i<count; i++) {
3052 if (PetscRealPart(va[i])(va[i]) < rvalues[i]) va[i] = rvalues[i];
3053 }
3054 }
3055 }
3056
3057 ierr = VecRestoreArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3057,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3058 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),3058,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3058,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3059 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3060}
3061
3062PetscErrorCode MatSOR_MPISBAIJ(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
3063{
3064 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
3065 PetscErrorCode ierr;
3066 PetscInt mbs=mat->mbs,bs=matin->rmap->bs;
3067 PetscScalar *x,*ptr,*from;
3068 Vec bb1;
3069 const PetscScalar *b;
3070
3071 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3071; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3072 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),3072,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive"
,its,lits)
;
3073 if (bs > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SSOR for block size > 1 is not yet implemented")return PetscError(((MPI_Comm)0x44000001),3073,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented"
)
;
3074
3075 if (flag == SOR_APPLY_UPPER) {
3076 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),3076,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3077 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3078 }
3079
3080 if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) {
3081 if (flag & SOR_ZERO_INITIAL_GUESS) {
3082 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),3082,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3083 its--;
3084 }
3085
3086 ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3086,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3087 while (its--) {
3088
3089 /* lower triangular part: slvec0b = - B^T*xx */
3090 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3090,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3091
3092 /* copy xx into slvec0a */
3093 ierr = VecGetArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3093,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3094 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3094,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3095 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),3095,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3096 ierr = VecRestoreArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3096,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3097
3098 ierr = VecScale(mat->slvec0,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3098,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3099
3100 /* copy bb into slvec1a */
3101 ierr = VecGetArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3101,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3102 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3102,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3103 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),3103,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3104 ierr = VecRestoreArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3104,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3105
3106 /* set slvec1b = 0 */
3107 ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3107,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3108
3109 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),3109,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3110 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3110,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3111 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3111,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3112 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),3112,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3113
3114 /* upper triangular part: bb1 = bb1 - B*x */
3115 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),3115,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3116
3117 /* local diagonal sweep */
3118 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),3118,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3119 }
3120 ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3120,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3121 } else if ((flag & SOR_LOCAL_FORWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) {
3122 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),3122,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3123 } else if ((flag & SOR_LOCAL_BACKWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) {
3124 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),3124,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3125 } else if (flag & SOR_EISENSTAT) {
3126 Vec xx1;
3127 PetscBool hasop;
3128 const PetscScalar *diag;
3129 PetscScalar *sl,scale = (omega - 2.0)/omega;
3130 PetscInt i,n;
3131
3132 if (!mat->xx1) {
3133 ierr = VecDuplicate(bb,&mat->xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3133,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3134 ierr = VecDuplicate(bb,&mat->bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3134,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3135 }
3136 xx1 = mat->xx1;
3137 bb1 = mat->bb1;
3138
3139 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),3139,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3140
3141 if (!mat->diag) {
3142 /* this is wrong for same matrix with new nonzero values */
3143 ierr = MatCreateVecs(matin,&mat->diag,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3143,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3144 ierr = MatGetDiagonal(matin,mat->diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3144,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3145 }
3146 ierr = MatHasOperation(matin,MATOP_MULT_DIAGONAL_BLOCK,&hasop);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3146,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3147
3148 if (hasop) {
3149 ierr = MatMultDiagonalBlock(matin,xx,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3149,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3150 ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3150,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3151 } else {
3152 /*
3153 These two lines are replaced by code that may be a bit faster for a good compiler
3154 ierr = VecPointwiseMult(mat->slvec1a,mat->diag,xx);CHKERRQ(ierr);
3155 ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr);
3156 */
3157 ierr = VecGetArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3157,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3158 ierr = VecGetArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3158,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3159 ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3159,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3160 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3160,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3161 ierr = VecGetLocalSize(xx,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3161,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3162 if (omega == 1.0) {
3163 for (i=0; i<n; i++) sl[i] = b[i] - diag[i]*x[i];
3164 ierr = PetscLogFlops(2.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3164,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3165 } else {
3166 for (i=0; i<n; i++) sl[i] = b[i] + scale*diag[i]*x[i];
3167 ierr = PetscLogFlops(3.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3167,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3168 }
3169 ierr = VecRestoreArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3169,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3170 ierr = VecRestoreArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3170,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3171 ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3171,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3172 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3172,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3173 }
3174
3175 /* multiply off-diagonal portion of matrix */
3176 ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3176,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3177 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3177,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3178 ierr = VecGetArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3178,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3179 ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3179,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3180 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),3180,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3181 ierr = VecRestoreArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3181,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3182 ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3182,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3183 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),3183,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3184 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),3184,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3185 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),3185,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3186
3187 /* local sweep */
3188 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),3188,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3189 ierr = VecAXPY(xx,1.0,xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3189,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3190 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3190,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format"
)
;
3191 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3192}
3193
3194PetscErrorCode MatSOR_MPISBAIJ_2comm(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx)
3195{
3196 Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data;
3197 PetscErrorCode ierr;
3198 Vec lvec1,bb1;
3199
3200 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3200; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3201 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),3201,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive"
,its,lits)
;
3202 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),3202,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented"
)
;
3203
3204 if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) {
3205 if (flag & SOR_ZERO_INITIAL_GUESS) {
3206 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),3206,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3207 its--;
3208 }
3209
3210 ierr = VecDuplicate(mat->lvec,&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3210,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3211 ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3211,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3212 while (its--) {
3213 ierr = VecScatterBegin(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3213,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3214
3215 /* lower diagonal part: bb1 = bb - B^T*xx */
3216 ierr = (*mat->B->ops->multtranspose)(mat->B,xx,lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3216,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3217 ierr = VecScale(lvec1,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3217,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3218
3219 ierr = VecScatterEnd(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3219,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3220 ierr = VecCopy(bb,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3220,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3221 ierr = VecScatterBegin(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3221,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3222
3223 /* upper diagonal part: bb1 = bb1 - B*x */
3224 ierr = VecScale(mat->lvec,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3224,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3225 ierr = (*mat->B->ops->multadd)(mat->B,mat->lvec,bb1,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3225,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3226
3227 ierr = VecScatterEnd(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3227,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3228
3229 /* diagonal sweep */
3230 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),3230,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3231 }
3232 ierr = VecDestroy(&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3232,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3233 ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3233,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3234 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3234,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format"
)
;
3235 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3236}
3237
3238/*@
3239 MatCreateMPISBAIJWithArrays - creates a MPI SBAIJ matrix using arrays that contain in standard
3240 CSR format the local rows.
3241
3242 Collective
3243
3244 Input Parameters:
3245+ comm - MPI communicator
3246. bs - the block size, only a block size of 1 is supported
3247. m - number of local rows (Cannot be PETSC_DECIDE)
3248. n - This value should be the same as the local size used in creating the
3249 x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have
3250 calculated if N is given) For square matrices n is almost always m.
3251. M - number of global rows (or PETSC_DETERMINE to have calculated if m is given)
3252. N - number of global columns (or PETSC_DETERMINE to have calculated if n is given)
3253. 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
3254. j - column indices
3255- a - matrix values
3256
3257 Output Parameter:
3258. mat - the matrix
3259
3260 Level: intermediate
3261
3262 Notes:
3263 The i, j, and a arrays ARE copied by this routine into the internal format used by PETSc;
3264 thus you CANNOT change the matrix entries by changing the values of a[] after you have
3265 called this routine. Use MatCreateMPIAIJWithSplitArrays() to avoid needing to copy the arrays.
3266
3267 The i and j indices are 0 based, and i indices are indices corresponding to the local j array.
3268
3269.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(),
3270 MPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays()
3271@*/
3272PetscErrorCode 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)
3273{
3274 PetscErrorCode ierr;
3275
3276
3277 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3277; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3278 if (i[0]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"i (row indices) must start with 0")return PetscError(((MPI_Comm)0x44000001),3278,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0")
;
3279 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),3279,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,63,PETSC_ERROR_INITIAL,"local number of rows (m) cannot be PETSC_DECIDE, or negative"
)
;
3280 ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3280,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3281 ierr = MatSetSizes(*mat,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3281,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3282 ierr = MatSetType(*mat,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3282,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3283 ierr = MatMPISBAIJSetPreallocationCSR(*mat,bs,i,j,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3283,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3284 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3285}
3286
3287
3288/*@C
3289 MatMPISBAIJSetPreallocationCSR - Creates a sparse parallel matrix in SBAIJ format using the given nonzero structure and (optional) numerical values
3290
3291 Collective
3292
3293 Input Parameters:
3294+ B - the matrix
3295. bs - the block size
3296. i - the indices into j for the start of each local row (starts with zero)
3297. j - the column indices for each local row (starts with zero) these must be sorted for each row
3298- v - optional values in the matrix
3299
3300 Level: advanced
3301
3302 Notes:
3303 Though this routine has Preallocation() in the name it also sets the exact nonzero locations of the matrix entries
3304 and usually the numerical values as well
3305
3306 Any entries below the diagaonl in are ignored
3307
3308.seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MPIAIJ
3309@*/
3310PetscErrorCode MatMPISBAIJSetPreallocationCSR(Mat B,PetscInt bs,const PetscInt i[],const PetscInt j[], const PetscScalar v[])
3311{
3312 PetscErrorCode ierr;
3313
3314 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3314; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3315 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),3315,__func__,"/sandbox/petsc/petsc.next/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),3315,__func__,"/sandbox/petsc/petsc.next/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),3315,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3316 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3317}
3318
3319PetscErrorCode MatCreateMPIMatConcatenateSeqMat_MPISBAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat)
3320{
3321 PetscErrorCode ierr;
3322 PetscInt m,N,i,rstart,nnz,Ii,bs,cbs;
3323 PetscInt *indx;
3324 PetscScalar *values;
3325
3326 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
; petscstack->line[petscstack->currentsize] = 3326; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3327 ierr = MatGetSize(inmat,&m,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3327,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3328 if (scall == MAT_INITIAL_MATRIX) { /* symbolic phase */
3329 Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)inmat->data;
3330 PetscInt *dnz,*onz,mbs,Nbs,nbs;
3331 PetscInt *bindx,rmax=a->rmax,j;
3332 PetscMPIInt rank,size;
3333
3334 ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3334,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3335 mbs = m/bs; Nbs = N/cbs;
3336 if (n == PETSC_DECIDE-1) {
3337 nbs = n;
3338 ierr = PetscSplitOwnership(comm,&nbs,&Nbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3338,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3339 n = nbs*cbs;
3340 } else {
3341 nbs = n/cbs;
3342 }
3343
3344 ierr = PetscMalloc1(rmax,&bindx)PetscMallocA(1,PETSC_FALSE,3344,__func__,"/sandbox/petsc/petsc.next/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),3344,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3345 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
,3345,__func__,"/sandbox/petsc/petsc.next/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),3345
,__func__,"/sandbox/petsc/petsc.next/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),3345
,__func__,"/sandbox/petsc/petsc.next/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),3345,__func__,"/sandbox/petsc/petsc.next/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),3345,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* inline function, output __end and __rstart are used below */
3346
3347 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3347,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3348 ierr = MPI_Comm_rank(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3348,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3349 if (rank == size-1) {
3350 /* Check sum(nbs) = Nbs */
3351 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),3351,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,75,PETSC_ERROR_INITIAL,"Sum of local block columns %D != global block columns %D"
,__end,Nbs)
;
3352 }
3353
3354 rstart = __rstart; /* block rstart of *outmat; see inline function MatPreallocateInitialize */
3355 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3355,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3356 for (i=0; i<mbs; i++) {
3357 ierr = MatGetRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3357,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* non-blocked nnz and indx */
3358 nnz = nnz/bs;
3359 for (j=0; j<nnz; j++) bindx[j] = indx[j*bs]/bs;
3360 ierr = MatPreallocateSet(i+rstart,nnz,bindx,dnz,onz)0;do { PetscInt __i; if (i+rstart < __rstart) return PetscError
(((MPI_Comm)0x44000001),3360,__func__,"/sandbox/petsc/petsc.next/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),3360,__func__,"/sandbox/petsc/petsc.next/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),3360,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3361 ierr = MatRestoreRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3361,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3362 }
3363 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3363,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3364 ierr = PetscFree(bindx)((*PetscTrFree)((void*)(bindx),3364,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
) || ((bindx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3364,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3365
3366 ierr = MatCreate(comm,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3366,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3367 ierr = MatSetSizes(*outmat,m,n,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3367,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3368 ierr = MatSetBlockSizes(*outmat,bs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3368,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3369 ierr = MatSetType(*outmat,MATSBAIJ"sbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3369,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3370 ierr = MatSeqSBAIJSetPreallocation(*outmat,bs,0,dnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3370,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3371 ierr = MatMPISBAIJSetPreallocation(*outmat,bs,0,dnz,0,onz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3371,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3372 ierr = MatPreallocateFinalize(dnz,onz)0;_4_ierr = PetscFreeA(2,3372,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,&(dnz),&(onz));do {if (__builtin_expect(!!(_4_ierr),
0)) return PetscError(((MPI_Comm)0x44000001),3372,__func__,"/sandbox/petsc/petsc.next/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),3372,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3373 }
3374
3375 /* numeric phase */
3376 ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3376,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3377 ierr = MatGetOwnershipRange(*outmat,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3377,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3378
3379 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3379,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3380 for (i=0; i<m; i++) {
3381 ierr = MatGetRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3381,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3382 Ii = i + rstart;
3383 ierr = MatSetValues(*outmat,1,&Ii,nnz,indx,values,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3383,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3384 ierr = MatRestoreRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3384,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3385 }
3386 ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3386,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3387 ierr = MatAssemblyBegin(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3387,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3388 ierr = MatAssemblyEnd(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3388,__func__,"/sandbox/petsc/petsc.next/src/mat/impls/sbaij/mpi/mpisbaij.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3389 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3390}

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

1#ifndef PETSCCTABLE_H
2#define PETSCCTABLE_H
3#include <petscsys.h>
4
5struct _n_PetscTable {
6 PetscInt *keytable;
7 PetscInt *table;
8 PetscInt count;
9 PetscInt tablesize;
10 PetscInt head;
11 PetscInt maxkey; /* largest key allowed */
12};
13
14typedef struct _n_PetscTable* PetscTable;
15typedef PetscInt* PetscTablePosition;
16
17PETSC_STATIC_INLINEstatic inline unsigned long PetscHash(PetscTable ta,unsigned long x)
18{
19 return(x%(unsigned long)ta->tablesize);
20}
21
22PETSC_STATIC_INLINEstatic inline unsigned long PetscHashStep(PetscTable ta,unsigned long x)
23{
24 return(1+(x%(unsigned long)(ta->tablesize-1)));
28
Division by zero
25}
26
27PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreate(const PetscInt,PetscInt,PetscTable*);
28PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreateCopy(const PetscTable,PetscTable*);
29PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableDestroy(PetscTable*);
30PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetCount(const PetscTable,PetscInt*);
31PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableIsEmpty(const PetscTable,PetscInt*);
32PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddExpand(PetscTable,PetscInt,PetscInt,InsertMode);
33PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddCountExpand(PetscTable,PetscInt);
34PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetHeadPosition(PetscTable,PetscTablePosition*);
35PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetNext(PetscTable,PetscTablePosition*,PetscInt*,PetscInt*);
36PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableRemoveAll(PetscTable);
37
38PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableAdd(PetscTable ta,PetscInt key,PetscInt data,InsertMode imode)
39{
40 PetscErrorCode ierr;
41 PetscInt i,hash = (PetscInt)PetscHash(ta,(unsigned long)key);
42 PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key);
43
44 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/include/petscctable.h"; petscstack
->line[petscstack->currentsize] = 44; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
45 if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key <= 0")return PetscError(((MPI_Comm)0x44000001),45,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key <= 0")
;
46 if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)return PetscError(((MPI_Comm)0x44000001),46,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D"
,key,ta->maxkey)
;
47 if (!data) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Null data")return PetscError(((MPI_Comm)0x44000001),47,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"Null data")
;
48
49 for (i=0; i<ta->tablesize; i++) {
50 if (ta->keytable[hash] == key) {
51 switch (imode) {
52 case INSERT_VALUES:
53 ta->table[hash] = data; /* over write */
54 break;
55 case ADD_VALUES:
56 ta->table[hash] += data;
57 break;
58 case MAX_VALUES:
59 ta->table[hash] = PetscMax(ta->table[hash],data)(((ta->table[hash])<(data)) ? (data) : (ta->table[hash
]))
;
60 break;
61 case NOT_SET_VALUES:
62 case INSERT_ALL_VALUES:
63 case ADD_ALL_VALUES:
64 case INSERT_BC_VALUES:
65 case ADD_BC_VALUES:
66 SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported InsertMode")return PetscError(((MPI_Comm)0x44000001),66,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,56,PETSC_ERROR_INITIAL,"Unsupported InsertMode")
;
67 }
68 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
69 } else if (!ta->keytable[hash]) {
70 if (ta->count < 5*(ta->tablesize/6) - 1) {
71 ta->count++; /* add */
72 ta->keytable[hash] = key;
73 ta->table[hash] = data;
74 } else {
75 ierr = PetscTableAddExpand(ta,key,data,imode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76 }
77 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
78 }
79 hash = (hash + hashstep)%ta->tablesize;
80 }
81 SETERRQ(PETSC_COMM_SELF,PETSC_ERR_COR,"Full table")return PetscError(((MPI_Comm)0x44000001),81,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,74,PETSC_ERROR_INITIAL,"Full table")
;
82 /* PetscFunctionReturn(0); */
83}
84
85PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableAddCount(PetscTable ta,PetscInt key)
86{
87 PetscErrorCode ierr;
88 PetscInt i,hash = (PetscInt)PetscHash(ta,(unsigned long)key);
89 PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key);
90
91 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/include/petscctable.h"; petscstack
->line[petscstack->currentsize] = 91; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
92 if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key <= 0")return PetscError(((MPI_Comm)0x44000001),92,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key <= 0")
;
93 if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)return PetscError(((MPI_Comm)0x44000001),93,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D"
,key,ta->maxkey)
;
94
95 for (i=0; i<ta->tablesize; i++) {
96 if (ta->keytable[hash] == key) {
97 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
98 } else if (!ta->keytable[hash]) {
99 if (ta->count < 5*(ta->tablesize/6) - 1) {
100 ta->count++; /* add */
101 ta->keytable[hash] = key;
102 ta->table[hash] = ta->count;
103 } else {
104 ierr = PetscTableAddCountExpand(ta,key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),104,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
105 }
106 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
107 }
108 hash = (hash + hashstep)%ta->tablesize;
109 }
110 SETERRQ(PETSC_COMM_SELF,PETSC_ERR_COR,"Full table")return PetscError(((MPI_Comm)0x44000001),110,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,74,PETSC_ERROR_INITIAL,"Full table")
;
111 /* PetscFunctionReturn(0); */
112}
113
114/*
115 PetscTableFind - checks if a key is in the table
116
117 If data==0, then no table entry exists.
118
119*/
120PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableFind(PetscTable ta,PetscInt key,PetscInt *data)
121{
122 PetscInt ii = 0;
123 PetscInt hash = (PetscInt)PetscHash(ta,(unsigned long)key);
124 PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key);
27
Calling 'PetscHashStep'
125
126 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next/include/petscctable.h"; petscstack
->line[petscstack->currentsize] = 126; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
127 *data = 0;
128 if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Key <= 0")return PetscError(((MPI_Comm)0x44000001),128,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"Key <= 0")
;
129 if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)return PetscError(((MPI_Comm)0x44000001),129,__func__,"/sandbox/petsc/petsc.next/include/petscctable.h"
,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D"
,key,ta->maxkey)
;
130
131 while (ii++ < ta->tablesize) {
132 if (!ta->keytable[hash]) break;
133 else if (ta->keytable[hash] == key) {
134 *data = ta->table[hash];
135 break;
136 }
137 hash = (hash + hashstep)%ta->tablesize;
138 }
139 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
140}
141
142#endif