Bug Summary

File:ksp/pc/impls/bddc/bddcprivate.c
Warning:line 2716, column 37
Array access (from variable 'subs') results in a null pointer dereference

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1#include <../src/mat/impls/aij/seq/aij.h>
2#include <../src/ksp/pc/impls/bddc/bddc.h>
3#include <../src/ksp/pc/impls/bddc/bddcprivate.h>
4#include <../src/mat/impls/dense/seq/dense.h>
5#include <petscdmplex.h>
6#include <petscblaslapack.h>
7#include <petsc/private/sfimpl.h>
8#include <petsc/private/dmpleximpl.h>
9#include <petscdmda.h>
10
11static PetscErrorCode MatMPIAIJRestrict(Mat,MPI_Comm,Mat*);
12
13/* if range is true, it returns B s.t. span{B} = range(A)
14 if range is false, it returns B s.t. range(B) _|_ range(A) */
15PetscErrorCode MatDenseOrthogonalRangeOrComplement(Mat A, PetscBool range, PetscInt lw, PetscScalar *work, PetscReal *rwork, Mat *B)
16{
17#if !defined(PETSC_USE_COMPLEX)
18 PetscScalar *uwork,*data,*U, ds = 0.;
19 PetscReal *sing;
20 PetscBLASInt bM,bN,lwork,lierr,di = 1;
21 PetscInt ulw,i,nr,nc,n;
22 PetscErrorCode ierr;
23
24 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 24; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
25#if defined(PETSC_MISSING_LAPACK_GESVD)
26 SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"LAPACK _GESVD not available")return PetscError(((MPI_Comm)0x44000001),26,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"LAPACK _GESVD not available")
;
27#else
28 ierr = MatGetSize(A,&nr,&nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),28,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
29 if (!nr || !nc) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
30
31 /* workspace */
32 if (!work) {
33 ulw = PetscMax(PetscMax(1,5*PetscMin(nr,nc)),3*PetscMin(nr,nc)+PetscMax(nr,nc))((((((1)<(5*(((nr)<(nc)) ? (nr) : (nc)))) ? (5*(((nr)<
(nc)) ? (nr) : (nc))) : (1)))<(3*(((nr)<(nc)) ? (nr) : (
nc))+(((nr)<(nc)) ? (nc) : (nr)))) ? (3*(((nr)<(nc)) ? (
nr) : (nc))+(((nr)<(nc)) ? (nc) : (nr))) : ((((1)<(5*((
(nr)<(nc)) ? (nr) : (nc)))) ? (5*(((nr)<(nc)) ? (nr) : (
nc))) : (1))))
;
34 ierr = PetscMalloc1(ulw,&uwork)PetscMallocA(1,PETSC_FALSE,34,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ulw)*sizeof(**(&uwork)),(&uwork))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),34,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
35 } else {
36 ulw = lw;
37 uwork = work;
38 }
39 n = PetscMin(nr,nc)(((nr)<(nc)) ? (nr) : (nc));
40 if (!rwork) {
41 ierr = PetscMalloc1(n,&sing)PetscMallocA(1,PETSC_FALSE,41,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&sing)),(&sing))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),41,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
42 } else {
43 sing = rwork;
44 }
45
46 /* SVD */
47 ierr = PetscMalloc1(nr*nr,&U)PetscMallocA(1,PETSC_FALSE,47,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nr*nr)*sizeof(**(&U)),(&U))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
48 ierr = PetscBLASIntCast(nr,&bM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),48,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
49 ierr = PetscBLASIntCast(nc,&bN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),49,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
50 ierr = PetscBLASIntCast(ulw,&lwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),50,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
51 ierr = MatDenseGetArray(A,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),51,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
52 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),52,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
53 PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("A","N",&bM,&bN,data,&bM,sing,U,&bM,&ds,&di,uwork,&lwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKgesvd"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 53; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgesvd_("A","N",&bM,&bN,data,&bM,sing,U,&bM,
&ds,&di,uwork,&lwork,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(53,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),53,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
54 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),54,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
55 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in GESVD Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),55,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in GESVD Lapack routine %d",(int
)lierr)
;
56 ierr = MatDenseRestoreArray(A,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),56,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
57 for (i=0;i<n;i++) if (sing[i] < PETSC_SMALL1.e-10) break;
58 if (!rwork) {
59 ierr = PetscFree(sing)((*PetscTrFree)((void*)(sing),59,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((sing) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),59,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
60 }
61 if (!work) {
62 ierr = PetscFree(uwork)((*PetscTrFree)((void*)(uwork),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((uwork) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
63 }
64 /* create B */
65 if (!range) {
66 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),nr,nr-i,NULL((void*)0),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),66,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
67 ierr = MatDenseGetArray(*B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),67,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
68 ierr = PetscMemcpy(data,U+nr*i,(nr-i)*nr*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),68,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
69 } else {
70 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),nr,i,NULL((void*)0),B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),70,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
71 ierr = MatDenseGetArray(*B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
72 ierr = PetscMemcpy(data,U,i*nr*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
73 }
74 ierr = MatDenseRestoreArray(*B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),74,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
75 ierr = PetscFree(U)((*PetscTrFree)((void*)(U),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((U) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76#endif
77#else /* PETSC_USE_COMPLEX */
78 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 78; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
79 SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented for complexes")return PetscError(((MPI_Comm)0x44000001),79,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not implemented for complexes")
;
80#endif
81 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
82}
83
84/* TODO REMOVE */
85#if defined(PRINT_GDET)
86static int inc = 0;
87static int lev = 0;
88#endif
89
90PetscErrorCode PCBDDCComputeNedelecChangeEdge(Mat lG, IS edge, IS extrow, IS extcol, IS corners, Mat* Gins, Mat* GKins, PetscScalar cvals[2], PetscScalar *work, PetscReal *rwork)
91{
92 PetscErrorCode ierr;
93 Mat GE,GEd;
94 PetscInt rsize,csize,esize;
95 PetscScalar *ptr;
96
97 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 97; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
98 ierr = ISGetSize(edge,&esize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),98,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
99 if (!esize) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
100 ierr = ISGetSize(extrow,&rsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
101 ierr = ISGetSize(extcol,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),101,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
102
103 /* gradients */
104 ptr = work + 5*esize;
105 ierr = MatCreateSubMatrix(lG,extrow,extcol,MAT_INITIAL_MATRIX,&GE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),105,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
106 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),rsize,csize,ptr,Gins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),106,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
107 ierr = MatConvert(GE,MATSEQDENSE"seqdense",MAT_REUSE_MATRIX,Gins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),107,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
108 ierr = MatDestroy(&GE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
109
110 /* constants */
111 ptr += rsize*csize;
112 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),esize,csize,ptr,&GEd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
113 ierr = MatCreateSubMatrix(lG,edge,extcol,MAT_INITIAL_MATRIX,&GE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
114 ierr = MatConvert(GE,MATSEQDENSE"seqdense",MAT_REUSE_MATRIX,&GEd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
115 ierr = MatDestroy(&GE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),115,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
116 ierr = MatDenseOrthogonalRangeOrComplement(GEd,PETSC_FALSE,5*esize,work,rwork,GKins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),116,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
117 ierr = MatDestroy(&GEd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),117,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
118
119 if (corners) {
120 Mat GEc;
121 PetscScalar *vals,v;
122
123 ierr = MatCreateSubMatrix(lG,edge,corners,MAT_INITIAL_MATRIX,&GEc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),123,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
124 ierr = MatTransposeMatMult(GEc,*GKins,MAT_INITIAL_MATRIX,1.0,&GEd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
125 ierr = MatDenseGetArray(GEd,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),125,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
126 /* v = PetscAbsScalar(vals[0]) */;
127 v = 1.;
128 cvals[0] = vals[0]/v;
129 cvals[1] = vals[1]/v;
130 ierr = MatDenseRestoreArray(GEd,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),130,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
131 ierr = MatScale(*GKins,1./v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
132#if defined(PRINT_GDET)
133 {
134 PetscViewer viewer;
135 char filename[256];
136 sprintf(filename,"Gdet_l%d_r%d_cc%d.m",lev,PetscGlobalRank,inc++);
137 ierr = PetscViewerASCIIOpen(PETSC_COMM_SELF((MPI_Comm)0x44000001),filename,&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),137,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
138 ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),138,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
139 ierr = PetscObjectSetName((PetscObject)GEc,"GEc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),139,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
140 ierr = MatView(GEc,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),140,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
141 ierr = PetscObjectSetName((PetscObject)(*GKins),"GK");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),141,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
142 ierr = MatView(*GKins,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),142,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
143 ierr = PetscObjectSetName((PetscObject)GEd,"Gproj");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),143,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
144 ierr = MatView(GEd,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),144,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
145 ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
146 }
147#endif
148 ierr = MatDestroy(&GEd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),148,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
149 ierr = MatDestroy(&GEc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),149,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
150 }
151
152 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
153}
154
155PetscErrorCode PCBDDCNedelecSupport(PC pc)
156{
157 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
158 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
159 Mat G,T,conn,lG,lGt,lGis,lGall,lGe,lGinit;
160 Vec tvec;
161 PetscSF sfv;
162 ISLocalToGlobalMapping el2g,vl2g,fl2g,al2g;
163 MPI_Comm comm;
164 IS lned,primals,allprimals,nedfieldlocal;
165 IS *eedges,*extrows,*extcols,*alleedges;
166 PetscBT btv,bte,btvc,btb,btbd,btvcand,btvi,btee,bter;
167 PetscScalar *vals,*work;
168 PetscReal *rwork;
169 const PetscInt *idxs,*ii,*jj,*iit,*jjt;
170 PetscInt ne,nv,Lv,order,n,field;
171 PetscInt n_neigh,*neigh,*n_shared,**shared;
172 PetscInt i,j,extmem,cum,maxsize,nee;
173 PetscInt *extrow,*extrowcum,*marks,*vmarks,*gidxs;
174 PetscInt *sfvleaves,*sfvroots;
175 PetscInt *corners,*cedges;
176 PetscInt *ecount,**eneighs,*vcount,**vneighs;
177#if defined(PETSC_USE_DEBUG1)
178 PetscInt *emarks;
179#endif
180 PetscBool print,eerr,done,lrc[2],conforming,global,singular,setprimal;
181 PetscErrorCode ierr;
182
183 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 183; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
184 /* If the discrete gradient is defined for a subset of dofs and global is true,
185 it assumes G is given in global ordering for all the dofs.
186 Otherwise, the ordering is global for the Nedelec field */
187 order = pcbddc->nedorder;
188 conforming = pcbddc->conforming;
189 field = pcbddc->nedfield;
190 global = pcbddc->nedglobal;
191 setprimal = PETSC_FALSE;
192 print = PETSC_FALSE;
193 singular = PETSC_FALSE;
194
195 /* Command line customization */
196 ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)pc),((PetscObject)pc)->prefix,"BDDC Nedelec options","PC")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)pc),((PetscObject)pc)->prefix,"BDDC Nedelec options"
,"PC");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
197 ierr = PetscOptionsBool("-pc_bddc_nedelec_field_primal","All edge dofs set as primals: Toselli's algorithm C",NULL,setprimal,&setprimal,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-pc_bddc_nedelec_field_primal"
,"All edge dofs set as primals: Toselli's algorithm C",((void
*)0),setprimal,&setprimal,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
198 ierr = PetscOptionsBool("-pc_bddc_nedelec_singular","Infer nullspace from discrete gradient",NULL,singular,&singular,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-pc_bddc_nedelec_singular"
,"Infer nullspace from discrete gradient",((void*)0),singular
,&singular,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
199 ierr = PetscOptionsInt("-pc_bddc_nedelec_order","Test variable order code (to be removed)",NULL,order,&order,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-pc_bddc_nedelec_order"
,"Test variable order code (to be removed)",((void*)0),order,
&order,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
200 /* print debug info TODO: to be removed */
201 ierr = PetscOptionsBool("-pc_bddc_nedelec_print","Print debug info",NULL,print,&print,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-pc_bddc_nedelec_print"
,"Print debug info",((void*)0),print,&print,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),201,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
202 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
203
204 /* Return if there are no edges in the decomposition and the problem is not singular */
205 ierr = MatGetLocalToGlobalMapping(pc->pmat,&al2g,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
206 ierr = ISLocalToGlobalMappingGetSize(al2g,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
207 ierr = PetscObjectGetComm((PetscObject)pc,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),207,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
208 if (!singular) {
209 ierr = VecGetArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),209,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
210 lrc[0] = PETSC_FALSE;
211 for (i=0;i<n;i++) {
212 if (PetscRealPart(vals[i])(vals[i]) > 2.) {
213 lrc[0] = PETSC_TRUE;
214 break;
215 }
216 }
217 ierr = VecRestoreArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
218 ierr = MPIU_Allreduce(&lrc[0],&lrc[1],1,MPIU_BOOL,MPI_LOR,comm)(PetscAllreduceBarrierCheck(comm,1,218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) ||
MPI_Allreduce((&lrc[0]),(&lrc[1]),(1),(MPIU_BOOL),((
MPI_Op)(0x58000007)),(comm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
219 if (!lrc[1]) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
220 }
221
222 /* Get Nedelec field */
223 if (pcbddc->n_ISForDofsLocal && field >= pcbddc->n_ISForDofsLocal) SETERRQ2(comm,PETSC_ERR_USER,"Invalid field for Nedelec %D: number of fields is %D",field,pcbddc->n_ISForDofsLocal)return PetscError(comm,223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Invalid field for Nedelec %D: number of fields is %D"
,field,pcbddc->n_ISForDofsLocal)
;
224 if (pcbddc->n_ISForDofsLocal && field >= 0) {
225 ierr = PetscObjectReference((PetscObject)pcbddc->ISForDofsLocal[field]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),225,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
226 nedfieldlocal = pcbddc->ISForDofsLocal[field];
227 ierr = ISGetLocalSize(nedfieldlocal,&ne);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),227,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
228 } else if (!pcbddc->n_ISForDofsLocal && field != PETSC_DECIDE-1) {
229 ne = n;
230 nedfieldlocal = NULL((void*)0);
231 global = PETSC_TRUE;
232 } else if (field == PETSC_DECIDE-1) {
233 PetscInt rst,ren,*idx;
234
235 ierr = PetscMemzero(matis->sf_leafdata,n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),235,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
236 ierr = PetscMemzero(matis->sf_rootdata,pc->pmat->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),236,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
237 ierr = MatGetOwnershipRange(pcbddc->discretegradient,&rst,&ren);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 for (i=rst;i<ren;i++) {
239 PetscInt nc;
240
241 ierr = MatGetRow(pcbddc->discretegradient,i,&nc,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),241,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
242 if (nc > 1) matis->sf_rootdata[i-rst] = 1;
243 ierr = MatRestoreRow(pcbddc->discretegradient,i,&nc,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
244 }
245 ierr = PetscSFBcastBegin(matis->sf,MPIU_INT((MPI_Datatype)0x4c000405),matis->sf_rootdata,matis->sf_leafdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
246 ierr = PetscSFBcastEnd(matis->sf,MPIU_INT((MPI_Datatype)0x4c000405),matis->sf_rootdata,matis->sf_leafdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
247 ierr = PetscMalloc1(n,&idx)PetscMallocA(1,PETSC_FALSE,247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&idx)),(&idx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
248 for (i=0,ne=0;i<n;i++) if (matis->sf_leafdata[i]) idx[ne++] = i;
249 ierr = ISCreateGeneral(comm,ne,idx,PETSC_OWN_POINTER,&nedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
250 } else {
251 SETERRQ(comm,PETSC_ERR_USER,"When multiple fields are present, the Nedelec field has to be specified")return PetscError(comm,251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"When multiple fields are present, the Nedelec field has to be specified"
)
;
252 }
253
254 /* Sanity checks */
255 if (!order && !conforming) SETERRQ(comm,PETSC_ERR_SUP,"Variable order and non-conforming spaces are not supported at the same time")return PetscError(comm,255,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Variable order and non-conforming spaces are not supported at the same time"
)
;
256 if (pcbddc->user_ChangeOfBasisMatrix) SETERRQ(comm,PETSC_ERR_SUP,"Cannot generate Nedelec support with user defined change of basis")return PetscError(comm,256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot generate Nedelec support with user defined change of basis"
)
;
257 if (order && ne%order) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_USER,"The number of local edge dofs %D it's not a multiple of the order %D",ne,order)return PetscError(((MPI_Comm)0x44000001),257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"The number of local edge dofs %D it's not a multiple of the order %D"
,ne,order)
;
258
259 /* Just set primal dofs and return */
260 if (setprimal) {
261 IS enedfieldlocal;
262 PetscInt *eidxs;
263
264 ierr = PetscMalloc1(ne,&eidxs)PetscMallocA(1,PETSC_FALSE,264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ne)*sizeof(**(&eidxs)),(&eidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
265 ierr = VecGetArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
266 if (nedfieldlocal) {
267 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
268 for (i=0,cum=0;i<ne;i++) {
269 if (PetscRealPart(vals[idxs[i]])(vals[idxs[i]]) > 2.) {
270 eidxs[cum++] = idxs[i];
271 }
272 }
273 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
274 } else {
275 for (i=0,cum=0;i<ne;i++) {
276 if (PetscRealPart(vals[i])(vals[i]) > 2.) {
277 eidxs[cum++] = i;
278 }
279 }
280 }
281 ierr = VecRestoreArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
282 ierr = ISCreateGeneral(comm,cum,eidxs,PETSC_COPY_VALUES,&enedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),282,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
283 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,enedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),283,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
284 ierr = PetscFree(eidxs)((*PetscTrFree)((void*)(eidxs),284,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),284,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
285 ierr = ISDestroy(&nedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),285,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
286 ierr = ISDestroy(&enedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
287 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
288 }
289
290 /* Compute some l2g maps */
291 if (nedfieldlocal) {
292 IS is;
293
294 /* need to map from the local Nedelec field to local numbering */
295 ierr = ISLocalToGlobalMappingCreateIS(nedfieldlocal,&fl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
296 /* need to map from the local Nedelec field to global numbering for the whole dofs*/
297 ierr = ISLocalToGlobalMappingApplyIS(al2g,nedfieldlocal,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
298 ierr = ISLocalToGlobalMappingCreateIS(is,&al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
299 /* need to map from the local Nedelec field to global numbering (for Nedelec only) */
300 if (global) {
301 ierr = PetscObjectReference((PetscObject)al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
302 el2g = al2g;
303 } else {
304 IS gis;
305
306 ierr = ISRenumber(is,NULL((void*)0),NULL((void*)0),&gis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
307 ierr = ISLocalToGlobalMappingCreateIS(gis,&el2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
308 ierr = ISDestroy(&gis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
309 }
310 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),310,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
311 } else {
312 /* restore default */
313 pcbddc->nedfield = -1;
314 /* one ref for the destruction of al2g, one for el2g */
315 ierr = PetscObjectReference((PetscObject)al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),315,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
316 ierr = PetscObjectReference((PetscObject)al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),316,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
317 el2g = al2g;
318 fl2g = NULL((void*)0);
319 }
320
321 /* Start communication to drop connections for interior edges (for cc analysis only) */
322 ierr = PetscMemzero(matis->sf_leafdata,n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),322,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
323 ierr = PetscMemzero(matis->sf_rootdata,pc->pmat->rmap->n*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),323,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
324 if (nedfieldlocal) {
325 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),325,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
326 for (i=0;i<ne;i++) matis->sf_leafdata[idxs[i]] = 1;
327 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),327,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
328 } else {
329 for (i=0;i<ne;i++) matis->sf_leafdata[i] = 1;
330 }
331 ierr = PetscSFReduceBegin(matis->sf,MPIU_INT((MPI_Datatype)0x4c000405),matis->sf_leafdata,matis->sf_rootdata,MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),331,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
332 ierr = PetscSFReduceEnd(matis->sf,MPIU_INT((MPI_Datatype)0x4c000405),matis->sf_leafdata,matis->sf_rootdata,MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),332,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
333
334 if (!singular) { /* drop connections with interior edges to avoid unneeded communications and memory movements */
335 ierr = MatDuplicate(pcbddc->discretegradient,MAT_COPY_VALUES,&G);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),335,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
336 ierr = MatSetOption(G,MAT_KEEP_NONZERO_PATTERN,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
337 if (global) {
338 PetscInt rst;
339
340 ierr = MatGetOwnershipRange(G,&rst,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),340,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
341 for (i=0,cum=0;i<pc->pmat->rmap->n;i++) {
342 if (matis->sf_rootdata[i] < 2) {
343 matis->sf_rootdata[cum++] = i + rst;
344 }
345 }
346 ierr = MatSetOption(G,MAT_NO_OFF_PROC_ZERO_ROWS,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),346,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
347 ierr = MatZeroRows(G,cum,matis->sf_rootdata,0.,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),347,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
348 } else {
349 PetscInt *tbz;
350
351 ierr = PetscMalloc1(ne,&tbz)PetscMallocA(1,PETSC_FALSE,351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ne)*sizeof(**(&tbz)),(&tbz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
352 ierr = PetscSFBcastBegin(matis->sf,MPIU_INT((MPI_Datatype)0x4c000405),matis->sf_rootdata,matis->sf_leafdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),352,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
353 ierr = PetscSFBcastEnd(matis->sf,MPIU_INT((MPI_Datatype)0x4c000405),matis->sf_rootdata,matis->sf_leafdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),353,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
354 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
355 for (i=0,cum=0;i<ne;i++)
356 if (matis->sf_leafdata[idxs[i]] == 1)
357 tbz[cum++] = i;
358 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),358,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
359 ierr = ISLocalToGlobalMappingApply(el2g,cum,tbz,tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),359,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
360 ierr = MatZeroRows(G,cum,tbz,0.,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),360,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
361 ierr = PetscFree(tbz)((*PetscTrFree)((void*)(tbz),361,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tbz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),361,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
362 }
363 } else { /* we need the entire G to infer the nullspace */
364 ierr = PetscObjectReference((PetscObject)pcbddc->discretegradient);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
365 G = pcbddc->discretegradient;
366 }
367
368 /* Extract subdomain relevant rows of G */
369 ierr = ISLocalToGlobalMappingGetIndices(el2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
370 ierr = ISCreateGeneral(comm,ne,idxs,PETSC_USE_POINTER,&lned);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),370,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
371 ierr = MatCreateSubMatrix(G,lned,NULL((void*)0),MAT_INITIAL_MATRIX,&lGall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),371,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
372 ierr = ISLocalToGlobalMappingRestoreIndices(el2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),372,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
373 ierr = ISDestroy(&lned);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
374 ierr = MatConvert(lGall,MATIS"is",MAT_INITIAL_MATRIX,&lGis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),374,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
375 ierr = MatDestroy(&lGall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
376 ierr = MatISGetLocalMat(lGis,&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
377
378 /* SF for nodal dofs communications */
379 ierr = MatGetLocalSize(G,NULL((void*)0),&Lv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),379,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
380 ierr = MatGetLocalToGlobalMapping(lGis,NULL((void*)0),&vl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),380,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
381 ierr = PetscObjectReference((PetscObject)vl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
382 ierr = ISLocalToGlobalMappingGetSize(vl2g,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
383 ierr = PetscSFCreate(comm,&sfv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
384 ierr = ISLocalToGlobalMappingGetIndices(vl2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
385 ierr = PetscSFSetGraphLayout(sfv,lGis->cmap,nv,NULL((void*)0),PETSC_OWN_POINTER,idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),385,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
386 ierr = ISLocalToGlobalMappingRestoreIndices(vl2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),386,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
387 i = singular ? 2 : 1;
388 ierr = PetscMalloc2(i*nv,&sfvleaves,i*Lv,&sfvroots)PetscMallocA(2,PETSC_FALSE,388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(i*nv)*sizeof(**(&sfvleaves)),(&sfvleaves),(
size_t)(i*Lv)*sizeof(**(&sfvroots)),(&sfvroots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
389
390 /* Destroy temporary G created in MATIS format and modified G */
391 ierr = PetscObjectReference((PetscObject)lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),391,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
392 ierr = MatDestroy(&lGis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
393 ierr = MatDestroy(&G);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),393,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
394
395 if (print) {
396 ierr = PetscObjectSetName((PetscObject)lG,"initial_lG");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),396,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
397 ierr = MatView(lG,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),397,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
398 }
399
400 /* Save lG for values insertion in change of basis */
401 ierr = MatDuplicate(lG,MAT_COPY_VALUES,&lGinit);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),401,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
402
403 /* Analyze the edge-nodes connections (duplicate lG) */
404 ierr = MatDuplicate(lG,MAT_COPY_VALUES,&lGe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
405 ierr = MatSetOption(lGe,MAT_KEEP_NONZERO_PATTERN,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),405,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
406 ierr = PetscBTCreate(nv,&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),406,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
407 ierr = PetscBTCreate(ne,&bte);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),407,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
408 ierr = PetscBTCreate(ne,&btb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),408,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
409 ierr = PetscBTCreate(ne,&btbd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
410 ierr = PetscBTCreate(nv,&btvcand);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),410,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
411 /* need to import the boundary specification to ensure the
412 proper detection of coarse edges' endpoints */
413 if (pcbddc->DirichletBoundariesLocal) {
414 IS is;
415
416 if (fl2g) {
417 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_MASK,pcbddc->DirichletBoundariesLocal,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
418 } else {
419 is = pcbddc->DirichletBoundariesLocal;
420 }
421 ierr = ISGetLocalSize(is,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),421,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
422 ierr = ISGetIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),422,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
423 for (i=0;i<cum;i++) {
424 if (idxs[i] >= 0) {
425 ierr = PetscBTSet(btb,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),425,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
426 ierr = PetscBTSet(btbd,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),426,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
427 }
428 }
429 ierr = ISRestoreIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
430 if (fl2g) {
431 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
432 }
433 }
434 if (pcbddc->NeumannBoundariesLocal) {
435 IS is;
436
437 if (fl2g) {
438 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_MASK,pcbddc->NeumannBoundariesLocal,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),438,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
439 } else {
440 is = pcbddc->NeumannBoundariesLocal;
441 }
442 ierr = ISGetLocalSize(is,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),442,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
443 ierr = ISGetIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),443,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
444 for (i=0;i<cum;i++) {
445 if (idxs[i] >= 0) {
446 ierr = PetscBTSet(btb,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),446,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
447 }
448 }
449 ierr = ISRestoreIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),449,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
450 if (fl2g) {
451 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),451,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
452 }
453 }
454
455 /* Count neighs per dof */
456 ierr = ISLocalToGlobalMappingGetNodeInfo(el2g,NULL((void*)0),&ecount,&eneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),456,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
457 ierr = ISLocalToGlobalMappingGetNodeInfo(vl2g,NULL((void*)0),&vcount,&vneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),457,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
458
459 /* need to remove coarse faces' dofs and coarse edges' dirichlet dofs
460 for proper detection of coarse edges' endpoints */
461 ierr = PetscBTCreate(ne,&btee);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),461,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
462 for (i=0;i<ne;i++) {
463 if ((ecount[i] > 2 && !PetscBTLookup(btbd,i)) || (ecount[i] == 2 && PetscBTLookup(btb,i))) {
464 ierr = PetscBTSet(btee,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
465 }
466 }
467 ierr = PetscMalloc1(ne,&marks)PetscMallocA(1,PETSC_FALSE,467,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ne)*sizeof(**(&marks)),(&marks))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),467,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
468 if (!conforming) {
469 ierr = MatTranspose(lGe,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),469,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
470 ierr = MatGetRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),470,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
471 }
472 ierr = MatGetRowIJ(lGe,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),472,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
473 ierr = MatSeqAIJGetArray(lGe,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),473,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
474 cum = 0;
475 for (i=0;i<ne;i++) {
476 /* eliminate rows corresponding to edge dofs belonging to coarse faces */
477 if (!PetscBTLookup(btee,i)) {
478 marks[cum++] = i;
479 continue;
480 }
481 /* set badly connected edge dofs as primal */
482 if (!conforming) {
483 if (ii[i+1]-ii[i] != order + 1) { /* every row of G on the coarse edge should list order+1 nodal dofs */
484 marks[cum++] = i;
485 ierr = PetscBTSet(bte,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
486 for (j=ii[i];j<ii[i+1];j++) {
487 ierr = PetscBTSet(btv,jj[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
488 }
489 } else {
490 /* every edge dofs should be connected trough a certain number of nodal dofs
491 to other edge dofs belonging to coarse edges
492 - at most 2 endpoints
493 - order-1 interior nodal dofs
494 - no undefined nodal dofs (nconn < order)
495 */
496 PetscInt ends = 0,ints = 0, undef = 0;
497 for (j=ii[i];j<ii[i+1];j++) {
498 PetscInt v = jj[j],k;
499 PetscInt nconn = iit[v+1]-iit[v];
500 for (k=iit[v];k<iit[v+1];k++) if (!PetscBTLookup(btee,jjt[k])) nconn--;
501 if (nconn > order) ends++;
502 else if (nconn == order) ints++;
503 else undef++;
504 }
505 if (undef || ends > 2 || ints != order -1) {
506 marks[cum++] = i;
507 ierr = PetscBTSet(bte,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),507,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
508 for (j=ii[i];j<ii[i+1];j++) {
509 ierr = PetscBTSet(btv,jj[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
510 }
511 }
512 }
513 }
514 /* We assume the order on the element edge is ii[i+1]-ii[i]-1 */
515 if (!order && ii[i+1] != ii[i]) {
516 PetscScalar val = 1./(ii[i+1]-ii[i]-1);
517 for (j=ii[i];j<ii[i+1];j++) vals[j] = val;
518 }
519 }
520 ierr = PetscBTDestroy(&btee);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),520,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
521 ierr = MatSeqAIJRestoreArray(lGe,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
522 ierr = MatRestoreRowIJ(lGe,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
523 if (!conforming) {
524 ierr = MatRestoreRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),524,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
525 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),525,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
526 }
527 ierr = MatZeroRows(lGe,cum,marks,0.,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),527,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
528
529 /* identify splitpoints and corner candidates */
530 ierr = MatTranspose(lGe,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),530,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
531 if (print) {
532 ierr = PetscObjectSetName((PetscObject)lGe,"edgerestr_lG");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),532,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
533 ierr = MatView(lGe,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),533,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
534 ierr = PetscObjectSetName((PetscObject)lGt,"edgerestr_lGt");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),534,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
535 ierr = MatView(lGt,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
536 }
537 ierr = MatGetRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),537,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
538 ierr = MatSeqAIJGetArray(lGt,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),538,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
539 for (i=0;i<nv;i++) {
540 PetscInt ord = order, test = ii[i+1]-ii[i], vc = vcount[i];
541 PetscBool sneighs = PETSC_TRUE, bdir = PETSC_FALSE;
542 if (!order) { /* variable order */
543 PetscReal vorder = 0.;
544
545 for (j=ii[i];j<ii[i+1];j++) vorder += PetscRealPart(vals[j])(vals[j]);
546 test = PetscFloorReal(vorder+10.*PETSC_SQRT_MACHINE_EPSILON)floor(vorder+10.*1.490116119384766e-08);
547 if (vorder-test > PETSC_SQRT_MACHINE_EPSILON1.490116119384766e-08) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected value for vorder: %g (%D)",vorder,test)return PetscError(((MPI_Comm)0x44000001),547,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected value for vorder: %g (%D)"
,vorder,test)
;
548 ord = 1;
549 }
550#if defined(PETSC_USE_DEBUG1)
551 if (test%ord) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected number of edge dofs %D connected with nodal dof %D with order %D",test,i,ord)return PetscError(((MPI_Comm)0x44000001),551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected number of edge dofs %D connected with nodal dof %D with order %D"
,test,i,ord)
;
552#endif
553 for (j=ii[i];j<ii[i+1] && sneighs;j++) {
554 if (PetscBTLookup(btbd,jj[j])) {
555 bdir = PETSC_TRUE;
556 break;
557 }
558 if (vc != ecount[jj[j]]) {
559 sneighs = PETSC_FALSE;
560 } else {
561 PetscInt k,*vn = vneighs[i], *en = eneighs[jj[j]];
562 for (k=0;k<vc;k++) {
563 if (vn[k] != en[k]) {
564 sneighs = PETSC_FALSE;
565 break;
566 }
567 }
568 }
569 }
570 if (!sneighs || test >= 3*ord || bdir) { /* splitpoints */
571 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"SPLITPOINT %D (%D %D %D)\n",i,!sneighs,test >= 3*ord,bdir);
572 ierr = PetscBTSet(btv,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),572,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
573 } else if (test == ord) {
574 if (order == 1 || (!order && ii[i+1]-ii[i] == 1)) {
575 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"ENDPOINT %D\n",i);
576 ierr = PetscBTSet(btv,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),576,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
577 } else {
578 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"CORNER CANDIDATE %D\n",i);
579 ierr = PetscBTSet(btvcand,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),579,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
580 }
581 }
582 }
583 ierr = ISLocalToGlobalMappingRestoreNodeInfo(el2g,NULL((void*)0),&ecount,&eneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
584 ierr = ISLocalToGlobalMappingRestoreNodeInfo(vl2g,NULL((void*)0),&vcount,&vneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),584,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
585 ierr = PetscBTDestroy(&btbd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),585,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
586
587 /* a candidate is valid if it is connected to another candidate via a non-primal edge dof */
588 if (order != 1) {
589 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"INSPECTING CANDIDATES\n");
590 ierr = MatGetRowIJ(lGe,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),590,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
591 for (i=0;i<nv;i++) {
592 if (PetscBTLookup(btvcand,i)) {
593 PetscBool found = PETSC_FALSE;
594 for (j=ii[i];j<ii[i+1] && !found;j++) {
595 PetscInt k,e = jj[j];
596 if (PetscBTLookup(bte,e)) continue;
597 for (k=iit[e];k<iit[e+1];k++) {
598 PetscInt v = jjt[k];
599 if (v != i && PetscBTLookup(btvcand,v)) {
600 found = PETSC_TRUE;
601 break;
602 }
603 }
604 }
605 if (!found) {
606 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," CANDIDATE %D CLEARED\n",i);
607 ierr = PetscBTClear(btvcand,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),607,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
608 } else {
609 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," CANDIDATE %D ACCEPTED\n",i);
610 }
611 }
612 }
613 ierr = MatRestoreRowIJ(lGe,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),613,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
614 }
615 ierr = MatSeqAIJRestoreArray(lGt,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),615,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
616 ierr = MatRestoreRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),616,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
617 ierr = MatDestroy(&lGe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),617,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
618
619 /* Get the local G^T explicitly */
620 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
621 ierr = MatTranspose(lG,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),621,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
622 ierr = MatSetOption(lGt,MAT_KEEP_NONZERO_PATTERN,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),622,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
623
624 /* Mark interior nodal dofs */
625 ierr = ISLocalToGlobalMappingGetInfo(vl2g,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),625,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
626 ierr = PetscBTCreate(nv,&btvi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),626,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
627 for (i=1;i<n_neigh;i++) {
628 for (j=0;j<n_shared[i];j++) {
629 ierr = PetscBTSet(btvi,shared[i][j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),629,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
630 }
631 }
632 ierr = ISLocalToGlobalMappingRestoreInfo(vl2g,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),632,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
633
634 /* communicate corners and splitpoints */
635 ierr = PetscMalloc1(nv,&vmarks)PetscMallocA(1,PETSC_FALSE,635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nv)*sizeof(**(&vmarks)),(&vmarks))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
636 ierr = PetscMemzero(sfvleaves,nv*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
637 ierr = PetscMemzero(sfvroots,Lv*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),637,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
638 for (i=0;i<nv;i++) if (PetscUnlikely(PetscBTLookup(btv,i))__builtin_expect(!!(PetscBTLookup(btv,i)),0)) sfvleaves[i] = 1;
639
640 if (print) {
641 IS tbz;
642
643 cum = 0;
644 for (i=0;i<nv;i++)
645 if (sfvleaves[i])
646 vmarks[cum++] = i;
647
648 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cum,vmarks,PETSC_COPY_VALUES,&tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),648,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
649 ierr = PetscObjectSetName((PetscObject)tbz,"corners_to_be_zeroed_local");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
650 ierr = ISView(tbz,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
651 ierr = ISDestroy(&tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
652 }
653
654 ierr = PetscSFReduceBegin(sfv,MPIU_INT((MPI_Datatype)0x4c000405),sfvleaves,sfvroots,MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
655 ierr = PetscSFReduceEnd(sfv,MPIU_INT((MPI_Datatype)0x4c000405),sfvleaves,sfvroots,MPI_SUM(MPI_Op)(0x58000003));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
656 ierr = PetscSFBcastBegin(sfv,MPIU_INT((MPI_Datatype)0x4c000405),sfvroots,sfvleaves);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),656,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
657 ierr = PetscSFBcastEnd(sfv,MPIU_INT((MPI_Datatype)0x4c000405),sfvroots,sfvleaves);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),657,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
658
659 /* Zero rows of lGt corresponding to identified corners
660 and interior nodal dofs */
661 cum = 0;
662 for (i=0;i<nv;i++) {
663 if (sfvleaves[i]) {
664 vmarks[cum++] = i;
665 ierr = PetscBTSet(btv,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),665,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
666 }
667 if (!PetscBTLookup(btvi,i)) vmarks[cum++] = i;
668 }
669 ierr = PetscBTDestroy(&btvi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
670 if (print) {
671 IS tbz;
672
673 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cum,vmarks,PETSC_COPY_VALUES,&tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
674 ierr = PetscObjectSetName((PetscObject)tbz,"corners_to_be_zeroed_with_interior");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
675 ierr = ISView(tbz,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),675,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
676 ierr = ISDestroy(&tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
677 }
678 ierr = MatZeroRows(lGt,cum,vmarks,0.,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
679 ierr = PetscFree(vmarks)((*PetscTrFree)((void*)(vmarks),679,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vmarks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),679,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
680 ierr = PetscSFDestroy(&sfv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),680,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
681 ierr = PetscFree2(sfvleaves,sfvroots)PetscFreeA(2,681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(sfvleaves),&(sfvroots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
682
683 /* Recompute G */
684 ierr = MatDestroy(&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),684,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
685 ierr = MatTranspose(lGt,MAT_INITIAL_MATRIX,&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),685,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
686 if (print) {
687 ierr = PetscObjectSetName((PetscObject)lG,"used_lG");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),687,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
688 ierr = MatView(lG,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
689 ierr = PetscObjectSetName((PetscObject)lGt,"used_lGt");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),689,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
690 ierr = MatView(lGt,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),690,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
691 }
692
693 /* Get primal dofs (if any) */
694 cum = 0;
695 for (i=0;i<ne;i++) {
696 if (PetscUnlikely(PetscBTLookup(bte,i))__builtin_expect(!!(PetscBTLookup(bte,i)),0)) marks[cum++] = i;
697 }
698 if (fl2g) {
699 ierr = ISLocalToGlobalMappingApply(fl2g,cum,marks,marks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
700 }
701 ierr = ISCreateGeneral(comm,cum,marks,PETSC_COPY_VALUES,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),701,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
702 if (print) {
703 ierr = PetscObjectSetName((PetscObject)primals,"prescribed_primal_dofs");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
704 ierr = ISView(primals,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
705 }
706 ierr = PetscBTDestroy(&bte);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
707 /* TODO: what if the user passed in some of them ? */
708 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),708,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
709 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),709,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
710
711 /* Compute edge connectivity */
712 ierr = PetscObjectSetOptionsPrefix((PetscObject)lG,"econn_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),712,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
713 ierr = MatMatMultSymbolic(lG,lGt,PETSC_DEFAULT-2,&conn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
714 ierr = MatGetRowIJ(conn,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
715 if (fl2g) {
716 PetscBT btf;
717 PetscInt *iia,*jja,*iiu,*jju;
718 PetscBool rest = PETSC_FALSE,free = PETSC_FALSE;
719
720 /* create CSR for all local dofs */
721 ierr = PetscMalloc1(n+1,&iia)PetscMallocA(1,PETSC_FALSE,721,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n+1)*sizeof(**(&iia)),(&iia))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),721,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
722 if (pcbddc->mat_graph->nvtxs_csr) { /* the user has passed in a CSR graph */
723 if (pcbddc->mat_graph->nvtxs_csr != n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_USER,"Invalid size of CSR graph %D. Should be %D",pcbddc->mat_graph->nvtxs_csr,n)return PetscError(((MPI_Comm)0x44000001),723,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Invalid size of CSR graph %D. Should be %D"
,pcbddc->mat_graph->nvtxs_csr,n)
;
724 iiu = pcbddc->mat_graph->xadj;
725 jju = pcbddc->mat_graph->adjncy;
726 } else if (pcbddc->use_local_adj) {
727 rest = PETSC_TRUE;
728 ierr = MatGetRowIJ(matis->A,0,PETSC_TRUE,PETSC_FALSE,&i,(const PetscInt**)&iiu,(const PetscInt**)&jju,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),728,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
729 } else {
730 free = PETSC_TRUE;
731 ierr = PetscMalloc2(n+1,&iiu,n,&jju)PetscMallocA(2,PETSC_FALSE,731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n+1)*sizeof(**(&iiu)),(&iiu),(size_t)(n)*sizeof
(**(&jju)),(&jju))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
732 iiu[0] = 0;
733 for (i=0;i<n;i++) {
734 iiu[i+1] = i+1;
735 jju[i] = -1;
736 }
737 }
738
739 /* import sizes of CSR */
740 iia[0] = 0;
741 for (i=0;i<n;i++) iia[i+1] = iiu[i+1]-iiu[i];
742
743 /* overwrite entries corresponding to the Nedelec field */
744 ierr = PetscBTCreate(n,&btf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),744,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
745 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),745,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
746 for (i=0;i<ne;i++) {
747 ierr = PetscBTSet(btf,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
748 iia[idxs[i]+1] = ii[i+1]-ii[i];
749 }
750
751 /* iia in CSR */
752 for (i=0;i<n;i++) iia[i+1] += iia[i];
753
754 /* jja in CSR */
755 ierr = PetscMalloc1(iia[n],&jja)PetscMallocA(1,PETSC_FALSE,755,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(iia[n])*sizeof(**(&jja)),(&jja))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),755,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
756 for (i=0;i<n;i++)
757 if (!PetscBTLookup(btf,i))
758 for (j=0;j<iiu[i+1]-iiu[i];j++)
759 jja[iia[i]+j] = jju[iiu[i]+j];
760
761 /* map edge dofs connectivity */
762 if (jj) {
763 ierr = ISLocalToGlobalMappingApply(fl2g,ii[ne],jj,(PetscInt *)jj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
764 for (i=0;i<ne;i++) {
765 PetscInt e = idxs[i];
766 for (j=0;j<ii[i+1]-ii[i];j++) jja[iia[e]+j] = jj[ii[i]+j];
767 }
768 }
769 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
770 ierr = PCBDDCSetLocalAdjacencyGraph(pc,n,iia,jja,PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),770,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
771 if (rest) {
772 ierr = MatRestoreRowIJ(matis->A,0,PETSC_TRUE,PETSC_FALSE,&i,(const PetscInt**)&iiu,(const PetscInt**)&jju,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
773 }
774 if (free) {
775 ierr = PetscFree2(iiu,jju)PetscFreeA(2,775,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(iiu),&(jju))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),775,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
776 }
777 ierr = PetscBTDestroy(&btf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),777,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
778 } else {
779 ierr = PCBDDCSetLocalAdjacencyGraph(pc,n,ii,jj,PETSC_USE_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
780 }
781
782 /* Analyze interface for edge dofs */
783 ierr = PCBDDCAnalyzeInterface(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),783,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
784 pcbddc->mat_graph->twodim = PETSC_FALSE;
785
786 /* Get coarse edges in the edge space */
787 ierr = PCBDDCGraphGetCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),&nee,&alleedges,&allprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),787,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
788 ierr = MatRestoreRowIJ(conn,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),788,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
789
790 if (fl2g) {
791 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,allprimals,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),791,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
792 ierr = PetscMalloc1(nee,&eedges)PetscMallocA(1,PETSC_FALSE,792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee)*sizeof(**(&eedges)),(&eedges))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
793 for (i=0;i<nee;i++) {
794 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,alleedges[i],&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
795 }
796 } else {
797 eedges = alleedges;
798 primals = allprimals;
799 }
800
801 /* Mark fine edge dofs with their coarse edge id */
802 ierr = PetscMemzero(marks,ne*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
803 ierr = ISGetLocalSize(primals,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
804 ierr = ISGetIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),804,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
805 for (i=0;i<cum;i++) marks[idxs[i]] = nee+1;
806 ierr = ISRestoreIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
807 if (print) {
808 ierr = PetscObjectSetName((PetscObject)primals,"obtained_primal_dofs");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
809 ierr = ISView(primals,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),809,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
810 }
811
812 maxsize = 0;
813 for (i=0;i<nee;i++) {
814 PetscInt size,mark = i+1;
815
816 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),816,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
817 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
818 for (j=0;j<size;j++) marks[idxs[j]] = mark;
819 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
820 maxsize = PetscMax(maxsize,size)(((maxsize)<(size)) ? (size) : (maxsize));
821 }
822
823 /* Find coarse edge endpoints */
824 ierr = MatGetRowIJ(lG,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
825 ierr = MatGetRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
826 for (i=0;i<nee;i++) {
827 PetscInt mark = i+1,size;
828
829 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),829,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
830 if (!size && nedfieldlocal) continue;
831 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),831,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
832 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),832,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
833 if (print) {
834 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"ENDPOINTS ANALYSIS EDGE %D\n",i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
835 ierr = ISView(eedges[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
836 }
837 for (j=0;j<size;j++) {
838 PetscInt k, ee = idxs[j];
839 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," idx %D\n",ee);
840 for (k=ii[ee];k<ii[ee+1];k++) {
841 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," inspect %D\n",jj[k]);
842 if (PetscBTLookup(btv,jj[k])) {
843 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," corner found (already set) %D\n",jj[k]);
844 } else if (PetscBTLookup(btvcand,jj[k])) { /* is it ok? */
845 PetscInt k2;
846 PetscBool corner = PETSC_FALSE;
847 for (k2 = iit[jj[k]];k2 < iit[jj[k]+1];k2++) {
848 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," INSPECTING %D: mark %D (ref mark %D), boundary %D\n",jjt[k2],marks[jjt[k2]],mark,!!PetscBTLookup(btb,jjt[k2]));
849 /* it's a corner if either is connected with an edge dof belonging to a different cc or
850 if the edge dof lie on the natural part of the boundary */
851 if ((marks[jjt[k2]] && marks[jjt[k2]] != mark) || (!marks[jjt[k2]] && PetscBTLookup(btb,jjt[k2]))) {
852 corner = PETSC_TRUE;
853 break;
854 }
855 }
856 if (corner) { /* found the nodal dof corresponding to the endpoint of the edge */
857 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," corner found %D\n",jj[k]);
858 ierr = PetscBTSet(btv,jj[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
859 } else {
860 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," no corners found\n");
861 }
862 }
863 }
864 }
865 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
866 }
867 ierr = MatRestoreRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
868 ierr = MatRestoreRowIJ(lG,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
869 ierr = PetscBTDestroy(&btb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
870
871 /* Reset marked primal dofs */
872 ierr = ISGetLocalSize(primals,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),872,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
873 ierr = ISGetIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
874 for (i=0;i<cum;i++) marks[idxs[i]] = 0;
875 ierr = ISRestoreIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
876
877 /* Now use the initial lG */
878 ierr = MatDestroy(&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),878,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
879 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),879,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
880 lG = lGinit;
881 ierr = MatTranspose(lG,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),881,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
882
883 /* Compute extended cols indices */
884 ierr = PetscBTCreate(nv,&btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),884,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
885 ierr = PetscBTCreate(nee,&bter);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
886 ierr = MatGetRowIJ(lG,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),886,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
887 ierr = MatSeqAIJGetMaxRowNonzeros(lG,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),887,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
888 i *= maxsize;
889 ierr = PetscCalloc1(nee,&extcols)PetscMallocA(1,PETSC_TRUE,889,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee)*sizeof(**(&extcols)),(&extcols))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),889,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
890 ierr = PetscMalloc2(i,&extrow,i,&gidxs)PetscMallocA(2,PETSC_FALSE,890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(i)*sizeof(**(&extrow)),(&extrow),(size_t)(i
)*sizeof(**(&gidxs)),(&gidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
891 eerr = PETSC_FALSE;
892 for (i=0;i<nee;i++) {
893 PetscInt size,found = 0;
894
895 cum = 0;
896 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
897 if (!size && nedfieldlocal) continue;
898 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),898,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
899 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),899,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
900 ierr = PetscBTMemzero(nv,btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),900,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
901 for (j=0;j<size;j++) {
902 PetscInt k,ee = idxs[j];
903 for (k=ii[ee];k<ii[ee+1];k++) {
904 PetscInt vv = jj[k];
905 if (!PetscBTLookup(btv,vv)) extrow[cum++] = vv;
906 else if (!PetscBTLookupSet(btvc,vv)) found++;
907 }
908 }
909 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
910 ierr = PetscSortRemoveDupsInt(&cum,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),910,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
911 ierr = ISLocalToGlobalMappingApply(vl2g,cum,extrow,gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),911,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
912 ierr = PetscSortIntWithArray(cum,gidxs,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),912,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
913 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cum,extrow,PETSC_COPY_VALUES,&extcols[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),913,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
914 /* it may happen that endpoints are not defined at this point
915 if it is the case, mark this edge for a second pass */
916 if (cum != size -1 || found != 2) {
917 ierr = PetscBTSet(bter,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
918 if (print) {
919 ierr = PetscObjectSetName((PetscObject)eedges[i],"error_edge");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),919,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
920 ierr = ISView(eedges[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
921 ierr = PetscObjectSetName((PetscObject)extcols[i],"error_extcol");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
922 ierr = ISView(extcols[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),922,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
923 }
924 eerr = PETSC_TRUE;
925 }
926 }
927 /* if (eerr) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected SIZE OF EDGE > EXTCOL FIRST PASS"); */
928 ierr = MPIU_Allreduce(&eerr,&done,1,MPIU_BOOL,MPI_LOR,comm)(PetscAllreduceBarrierCheck(comm,1,928,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) ||
MPI_Allreduce((&eerr),(&done),(1),(MPIU_BOOL),((MPI_Op
)(0x58000007)),(comm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),928,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
929 if (done) {
930 PetscInt *newprimals;
931
932 ierr = PetscMalloc1(ne,&newprimals)PetscMallocA(1,PETSC_FALSE,932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ne)*sizeof(**(&newprimals)),(&newprimals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
933 ierr = ISGetLocalSize(primals,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
934 ierr = ISGetIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
935 ierr = PetscMemcpy(newprimals,idxs,cum*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
936 ierr = ISRestoreIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),936,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
937 ierr = MatGetRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
938 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"DOING SECOND PASS (eerr %D)\n",eerr);
939 for (i=0;i<nee;i++) {
940 PetscBool has_candidates = PETSC_FALSE;
941 if (PetscBTLookup(bter,i)) {
942 PetscInt size,mark = i+1;
943
944 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
945 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),945,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
946 /* for (j=0;j<size;j++) newprimals[cum++] = idxs[j]; */
947 for (j=0;j<size;j++) {
948 PetscInt k,ee = idxs[j];
949 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"Inspecting edge dof %D [%D %D)\n",ee,ii[ee],ii[ee+1]);
950 for (k=ii[ee];k<ii[ee+1];k++) {
951 /* set all candidates located on the edge as corners */
952 if (PetscBTLookup(btvcand,jj[k])) {
953 PetscInt k2,vv = jj[k];
954 has_candidates = PETSC_TRUE;
955 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Candidate set to vertex %D\n",vv);
956 ierr = PetscBTSet(btv,vv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),956,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
957 /* set all edge dofs connected to candidate as primals */
958 for (k2=iit[vv];k2<iit[vv+1];k2++) {
959 if (marks[jjt[k2]] == mark) {
960 PetscInt k3,ee2 = jjt[k2];
961 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Connected edge dof set to primal %D\n",ee2);
962 newprimals[cum++] = ee2;
963 /* finally set the new corners */
964 for (k3=ii[ee2];k3<ii[ee2+1];k3++) {
965 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Connected nodal dof set to vertex %D\n",jj[k3]);
966 ierr = PetscBTSet(btv,jj[k3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),966,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
967 }
968 }
969 }
970 } else {
971 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Not a candidate vertex %D\n",jj[k]);
972 }
973 }
974 }
975 if (!has_candidates) { /* circular edge */
976 PetscInt k, ee = idxs[0],*tmarks;
977
978 ierr = PetscCalloc1(ne,&tmarks)PetscMallocA(1,PETSC_TRUE,978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ne)*sizeof(**(&tmarks)),(&tmarks))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
979 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Circular edge %D\n",i);
980 for (k=ii[ee];k<ii[ee+1];k++) {
981 PetscInt k2;
982 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Set to corner %D\n",jj[k]);
983 ierr = PetscBTSet(btv,jj[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),983,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
984 for (k2=iit[jj[k]];k2<iit[jj[k]+1];k2++) tmarks[jjt[k2]]++;
985 }
986 for (j=0;j<size;j++) {
987 if (tmarks[idxs[j]] > 1) {
988 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Edge dof set to primal %D\n",idxs[j]);
989 newprimals[cum++] = idxs[j];
990 }
991 }
992 ierr = PetscFree(tmarks)((*PetscTrFree)((void*)(tmarks),992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tmarks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
993 }
994 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),994,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
995 }
996 ierr = ISDestroy(&extcols[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
997 }
998 ierr = PetscFree(extcols)((*PetscTrFree)((void*)(extcols),998,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extcols) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),998,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
999 ierr = MatRestoreRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&iit,&jjt,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),999,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1000 ierr = PetscSortRemoveDupsInt(&cum,newprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1000,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1001 if (fl2g) {
1002 ierr = ISLocalToGlobalMappingApply(fl2g,cum,newprimals,newprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1002,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1003 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1003,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1004 for (i=0;i<nee;i++) {
1005 ierr = ISDestroy(&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1005,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1006 }
1007 ierr = PetscFree(eedges)((*PetscTrFree)((void*)(eedges),1007,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eedges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1007,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1008 }
1009 ierr = PCBDDCGraphRestoreCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),&nee,&alleedges,&allprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1009,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1010 ierr = ISCreateGeneral(comm,cum,newprimals,PETSC_COPY_VALUES,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1010,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1011 ierr = PetscFree(newprimals)((*PetscTrFree)((void*)(newprimals),1011,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((newprimals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1011,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1012 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1012,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1013 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1013,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1014 ierr = PCBDDCAnalyzeInterface(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1014,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1015 pcbddc->mat_graph->twodim = PETSC_FALSE;
1016 ierr = PCBDDCGraphGetCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),&nee,&alleedges,&allprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1016,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1017 if (fl2g) {
1018 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,allprimals,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1018,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1019 ierr = PetscMalloc1(nee,&eedges)PetscMallocA(1,PETSC_FALSE,1019,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee)*sizeof(**(&eedges)),(&eedges))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1019,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1020 for (i=0;i<nee;i++) {
1021 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,alleedges[i],&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1021,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1022 }
1023 } else {
1024 eedges = alleedges;
1025 primals = allprimals;
1026 }
1027 ierr = PetscCalloc1(nee,&extcols)PetscMallocA(1,PETSC_TRUE,1027,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee)*sizeof(**(&extcols)),(&extcols))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1027,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1028
1029 /* Mark again */
1030 ierr = PetscMemzero(marks,ne*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1030,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1031 for (i=0;i<nee;i++) {
1032 PetscInt size,mark = i+1;
1033
1034 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1034,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1035 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1035,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1036 for (j=0;j<size;j++) marks[idxs[j]] = mark;
1037 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1037,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1038 }
1039 if (print) {
1040 ierr = PetscObjectSetName((PetscObject)primals,"obtained_primal_dofs_secondpass");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1040,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1041 ierr = ISView(primals,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1042 }
1043
1044 /* Recompute extended cols */
1045 eerr = PETSC_FALSE;
1046 for (i=0;i<nee;i++) {
1047 PetscInt size;
1048
1049 cum = 0;
1050 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1050,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1051 if (!size && nedfieldlocal) continue;
1052 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),1052,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
1053 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1054 for (j=0;j<size;j++) {
1055 PetscInt k,ee = idxs[j];
1056 for (k=ii[ee];k<ii[ee+1];k++) if (!PetscBTLookup(btv,jj[k])) extrow[cum++] = jj[k];
1057 }
1058 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1059 ierr = PetscSortRemoveDupsInt(&cum,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1060 ierr = ISLocalToGlobalMappingApply(vl2g,cum,extrow,gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1061 ierr = PetscSortIntWithArray(cum,gidxs,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1061,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1062 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cum,extrow,PETSC_COPY_VALUES,&extcols[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1063 if (cum != size -1) {
1064 if (print) {
1065 ierr = PetscObjectSetName((PetscObject)eedges[i],"error_edge_secondpass");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1066 ierr = ISView(eedges[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1067 ierr = PetscObjectSetName((PetscObject)extcols[i],"error_extcol_secondpass");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1067,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1068 ierr = ISView(extcols[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1068,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1069 }
1070 eerr = PETSC_TRUE;
1071 }
1072 }
1073 }
1074 ierr = MatRestoreRowIJ(lG,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1074,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1075 ierr = PetscFree2(extrow,gidxs)PetscFreeA(2,1075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(extrow),&(gidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1076 ierr = PetscBTDestroy(&bter);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1076,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1077 if (print) { ierr = PCBDDCGraphASCIIView(pcbddc->mat_graph,5,PETSC_VIEWER_STDOUT_SELFPETSC_VIEWER_STDOUT_(((MPI_Comm)0x44000001)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
1078 /* an error should not occur at this point */
1079 if (eerr) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected SIZE OF EDGE > EXTCOL SECOND PASS")return PetscError(((MPI_Comm)0x44000001),1079,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected SIZE OF EDGE > EXTCOL SECOND PASS"
)
;
1080
1081 /* Check the number of endpoints */
1082 ierr = MatGetRowIJ(lG,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1082,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1083 ierr = PetscMalloc1(2*nee,&corners)PetscMallocA(1,PETSC_FALSE,1083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(2*nee)*sizeof(**(&corners)),(&corners))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1084 ierr = PetscMalloc1(nee,&cedges)PetscMallocA(1,PETSC_FALSE,1084,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee)*sizeof(**(&cedges)),(&cedges))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1084,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1085 for (i=0;i<nee;i++) {
1086 PetscInt size, found = 0, gc[2];
1087
1088 /* init with defaults */
1089 cedges[i] = corners[i*2] = corners[i*2+1] = -1;
1090 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1090,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1091 if (!size && nedfieldlocal) continue;
1092 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),1092,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
1093 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1094 ierr = PetscBTMemzero(nv,btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1095 for (j=0;j<size;j++) {
1096 PetscInt k,ee = idxs[j];
1097 for (k=ii[ee];k<ii[ee+1];k++) {
1098 PetscInt vv = jj[k];
1099 if (PetscBTLookup(btv,vv) && !PetscBTLookupSet(btvc,vv)) {
1100 if (found == 2) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Found more then two corners for edge %D",i)return PetscError(((MPI_Comm)0x44000001),1100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Found more then two corners for edge %D"
,i)
;
1101 corners[i*2+found++] = vv;
1102 }
1103 }
1104 }
1105 if (found != 2) {
1106 PetscInt e;
1107 if (fl2g) {
1108 ierr = ISLocalToGlobalMappingApply(fl2g,1,idxs,&e);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1109 } else {
1110 e = idxs[0];
1111 }
1112 SETERRQ4(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Found %D corners for edge %D (astart %D, estart %D)",found,i,e,idxs[0])return PetscError(((MPI_Comm)0x44000001),1112,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Found %D corners for edge %D (astart %D, estart %D)"
,found,i,e,idxs[0])
;
1113 }
1114
1115 /* get primal dof index on this coarse edge */
1116 ierr = ISLocalToGlobalMappingApply(vl2g,2,corners+2*i,gc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1116,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1117 if (gc[0] > gc[1]) {
1118 PetscInt swap = corners[2*i];
1119 corners[2*i] = corners[2*i+1];
1120 corners[2*i+1] = swap;
1121 }
1122 cedges[i] = idxs[size-1];
1123 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1123,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1124 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"EDGE %D: ce %D, corners (%D,%D)\n",i,cedges[i],corners[2*i],corners[2*i+1]);
1125 }
1126 ierr = MatRestoreRowIJ(lG,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1127 ierr = PetscBTDestroy(&btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1128
1129#if defined(PETSC_USE_DEBUG1)
1130 /* Inspects columns of lG (rows of lGt) and make sure the change of basis will
1131 not interfere with neighbouring coarse edges */
1132 ierr = PetscMalloc1(nee+1,&emarks)PetscMallocA(1,PETSC_FALSE,1132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee+1)*sizeof(**(&emarks)),(&emarks))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1133 ierr = MatGetRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1134 for (i=0;i<nv;i++) {
1135 PetscInt emax = 0,eemax = 0;
1136
1137 if (ii[i+1]==ii[i] || PetscBTLookup(btv,i)) continue;
1138 ierr = PetscMemzero(emarks,(nee+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1138,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1139 for (j=ii[i];j<ii[i+1];j++) emarks[marks[jj[j]]]++;
1140 for (j=1;j<nee+1;j++) {
1141 if (emax < emarks[j]) {
1142 emax = emarks[j];
1143 eemax = j;
1144 }
1145 }
1146 /* not relevant for edges */
1147 if (!eemax) continue;
1148
1149 for (j=ii[i];j<ii[i+1];j++) {
1150 if (marks[jj[j]] && marks[jj[j]] != eemax) {
1151 SETERRQ4(PETSC_COMM_SELF,PETSC_ERR_SUP,"Found 2 coarse edges (id %D and %D) connected through the %D nodal dof at edge dof %D",marks[jj[j]]-1,eemax,i,jj[j])return PetscError(((MPI_Comm)0x44000001),1151,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Found 2 coarse edges (id %D and %D) connected through the %D nodal dof at edge dof %D"
,marks[jj[j]]-1,eemax,i,jj[j])
;
1152 }
1153 }
1154 }
1155 ierr = PetscFree(emarks)((*PetscTrFree)((void*)(emarks),1155,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((emarks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1155,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1156 ierr = MatRestoreRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1156,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1157#endif
1158
1159 /* Compute extended rows indices for edge blocks of the change of basis */
1160 ierr = MatGetRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1161 ierr = MatSeqAIJGetMaxRowNonzeros(lGt,&extmem);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1161,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1162 extmem *= maxsize;
1163 ierr = PetscMalloc1(extmem*nee,&extrow)PetscMallocA(1,PETSC_FALSE,1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(extmem*nee)*sizeof(**(&extrow)),(&extrow))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1164 ierr = PetscMalloc1(nee,&extrows)PetscMallocA(1,PETSC_FALSE,1164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee)*sizeof(**(&extrows)),(&extrows))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1165 ierr = PetscCalloc1(nee,&extrowcum)PetscMallocA(1,PETSC_TRUE,1165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nee)*sizeof(**(&extrowcum)),(&extrowcum))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1166 for (i=0;i<nv;i++) {
1167 PetscInt mark = 0,size,start;
1168
1169 if (ii[i+1]==ii[i] || PetscBTLookup(btv,i)) continue;
1170 for (j=ii[i];j<ii[i+1];j++)
1171 if (marks[jj[j]] && !mark)
1172 mark = marks[jj[j]];
1173
1174 /* not relevant */
1175 if (!mark) continue;
1176
1177 /* import extended row */
1178 mark--;
1179 start = mark*extmem+extrowcum[mark];
1180 size = ii[i+1]-ii[i];
1181 if (extrowcum[mark] + size > extmem) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Not enough memory allocated %D > %D",extrowcum[mark] + size,extmem)return PetscError(((MPI_Comm)0x44000001),1181,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Not enough memory allocated %D > %D"
,extrowcum[mark] + size,extmem)
;
1182 ierr = PetscMemcpy(extrow+start,jj+ii[i],size*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1183 extrowcum[mark] += size;
1184 }
1185 ierr = MatRestoreRowIJ(lGt,0,PETSC_FALSE,PETSC_FALSE,&i,&ii,&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1185,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1186 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1186,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1187 ierr = PetscFree(marks)((*PetscTrFree)((void*)(marks),1187,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((marks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1187,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1188
1189 /* Compress extrows */
1190 cum = 0;
1191 for (i=0;i<nee;i++) {
1192 PetscInt size = extrowcum[i],*start = extrow + i*extmem;
1193 ierr = PetscSortRemoveDupsInt(&size,start);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1193,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1194 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),size,start,PETSC_USE_POINTER,&extrows[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1194,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1195 cum = PetscMax(cum,size)(((cum)<(size)) ? (size) : (cum));
1196 }
1197 ierr = PetscFree(extrowcum)((*PetscTrFree)((void*)(extrowcum),1197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extrowcum) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1198 ierr = PetscBTDestroy(&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1199 ierr = PetscBTDestroy(&btvcand);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1200
1201 /* Workspace for lapack inner calls and VecSetValues */
1202 ierr = PetscMalloc2((5+cum+maxsize)*maxsize,&work,maxsize,&rwork)PetscMallocA(2,PETSC_FALSE,1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)((5+cum+maxsize)*maxsize)*sizeof(**(&work)),(&
work),(size_t)(maxsize)*sizeof(**(&rwork)),(&rwork))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1203
1204 /* Create change of basis matrix (preallocation can be improved) */
1205 ierr = MatCreate(comm,&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1206 ierr = MatSetSizes(T,pc->pmat->rmap->n,pc->pmat->rmap->n,
1207 pc->pmat->rmap->N,pc->pmat->rmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1207,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1208 ierr = MatSetType(T,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1208,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1209 ierr = MatSeqAIJSetPreallocation(T,10,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1210 ierr = MatMPIAIJSetPreallocation(T,10,NULL((void*)0),10,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1210,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1211 ierr = MatSetLocalToGlobalMapping(T,al2g,al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1212 ierr = MatSetOption(T,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1213 ierr = MatSetOption(T,MAT_ROW_ORIENTED,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1214 ierr = ISLocalToGlobalMappingDestroy(&al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1214,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1215
1216 /* Defaults to identity */
1217 ierr = MatCreateVecs(pc->pmat,&tvec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1218 ierr = VecSet(tvec,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1219 ierr = MatDiagonalSet(T,tvec,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1220 ierr = VecDestroy(&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1220,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1221
1222 /* Create discrete gradient for the coarser level if needed */
1223 ierr = MatDestroy(&pcbddc->nedcG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1224 ierr = ISDestroy(&pcbddc->nedclocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1224,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1225 if (pcbddc->current_level < pcbddc->max_levels) {
1226 ISLocalToGlobalMapping cel2g,cvl2g;
1227 IS wis,gwis;
1228 PetscInt cnv,cne;
1229
1230 ierr = ISCreateGeneral(comm,nee,cedges,PETSC_COPY_VALUES,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1230,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1231 if (fl2g) {
1232 ierr = ISLocalToGlobalMappingApplyIS(fl2g,wis,&pcbddc->nedclocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1232,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1233 } else {
1234 ierr = PetscObjectReference((PetscObject)wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1234,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1235 pcbddc->nedclocal = wis;
1236 }
1237 ierr = ISLocalToGlobalMappingApplyIS(el2g,wis,&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1237,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1238 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1239 ierr = ISRenumber(gwis,NULL((void*)0),&cne,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1239,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1240 ierr = ISLocalToGlobalMappingCreateIS(wis,&cel2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1241 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1241,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1242 ierr = ISDestroy(&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1242,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1243
1244 ierr = ISCreateGeneral(comm,2*nee,corners,PETSC_USE_POINTER,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1244,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1245 ierr = ISLocalToGlobalMappingApplyIS(vl2g,wis,&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1246 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1247 ierr = ISRenumber(gwis,NULL((void*)0),&cnv,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1248 ierr = ISLocalToGlobalMappingCreateIS(wis,&cvl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1249 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1250 ierr = ISDestroy(&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1251
1252 ierr = MatCreate(comm,&pcbddc->nedcG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1252,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1253 ierr = MatSetSizes(pcbddc->nedcG,PETSC_DECIDE-1,PETSC_DECIDE-1,cne,cnv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1254 ierr = MatSetType(pcbddc->nedcG,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1254,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1255 ierr = MatSeqAIJSetPreallocation(pcbddc->nedcG,2,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1255,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1256 ierr = MatMPIAIJSetPreallocation(pcbddc->nedcG,2,NULL((void*)0),2,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1257 ierr = MatSetLocalToGlobalMapping(pcbddc->nedcG,cel2g,cvl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1258 ierr = ISLocalToGlobalMappingDestroy(&cel2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1259 ierr = ISLocalToGlobalMappingDestroy(&cvl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1260 }
1261 ierr = ISLocalToGlobalMappingDestroy(&vl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1261,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1262
1263#if defined(PRINT_GDET)
1264 inc = 0;
1265 lev = pcbddc->current_level;
1266#endif
1267
1268 /* Insert values in the change of basis matrix */
1269 for (i=0;i<nee;i++) {
1270 Mat Gins = NULL((void*)0), GKins = NULL((void*)0);
1271 IS cornersis = NULL((void*)0);
1272 PetscScalar cvals[2];
1273
1274 if (pcbddc->nedcG) {
1275 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),2,corners+2*i,PETSC_USE_POINTER,&cornersis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1275,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1276 }
1277 ierr = PCBDDCComputeNedelecChangeEdge(lG,eedges[i],extrows[i],extcols[i],cornersis,&Gins,&GKins,cvals,work,rwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1278 if (Gins && GKins) {
1279 PetscScalar *data;
1280 const PetscInt *rows,*cols;
1281 PetscInt nrh,nch,nrc,ncc;
1282
1283 ierr = ISGetIndices(eedges[i],&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1283,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1284 /* H1 */
1285 ierr = ISGetIndices(extrows[i],&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1285,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1286 ierr = MatGetSize(Gins,&nrh,&nch);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1287 ierr = MatDenseGetArray(Gins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1288 ierr = MatSetValuesLocal(T,nrh,rows,nch,cols,data,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1289 ierr = MatDenseRestoreArray(Gins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1289,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1290 ierr = ISRestoreIndices(extrows[i],&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1291 /* complement */
1292 ierr = MatGetSize(GKins,&nrc,&ncc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1292,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1293 if (!ncc) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Constant function has not been generated for coarse edge %D",i)return PetscError(((MPI_Comm)0x44000001),1293,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Constant function has not been generated for coarse edge %D"
,i)
;
1294 if (ncc + nch != nrc) SETERRQ4(PETSC_COMM_SELF,PETSC_ERR_PLIB,"The sum of the number of columns of GKins %D and Gins %D does not match %D for coarse edge %D",ncc,nch,nrc,i)return PetscError(((MPI_Comm)0x44000001),1294,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"The sum of the number of columns of GKins %D and Gins %D does not match %D for coarse edge %D"
,ncc,nch,nrc,i)
;
1295 if (ncc != 1 && pcbddc->nedcG) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cannot generate the coarse discrete gradient for coarse edge %D with ncc %D",i,ncc)return PetscError(((MPI_Comm)0x44000001),1295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot generate the coarse discrete gradient for coarse edge %D with ncc %D"
,i,ncc)
;
1296 ierr = MatDenseGetArray(GKins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1297 ierr = MatSetValuesLocal(T,nrc,cols,ncc,cols+nch,data,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1298 ierr = MatDenseRestoreArray(GKins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1299
1300 /* coarse discrete gradient */
1301 if (pcbddc->nedcG) {
1302 PetscInt cols[2];
1303
1304 cols[0] = 2*i;
1305 cols[1] = 2*i+1;
1306 ierr = MatSetValuesLocal(pcbddc->nedcG,1,&i,2,cols,cvals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1307 }
1308 ierr = ISRestoreIndices(eedges[i],&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1309 }
1310 ierr = ISDestroy(&extrows[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1310,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1311 ierr = ISDestroy(&extcols[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1311,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1312 ierr = ISDestroy(&cornersis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1312,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1313 ierr = MatDestroy(&Gins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1313,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1314 ierr = MatDestroy(&GKins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1314,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1315 }
1316 ierr = ISLocalToGlobalMappingDestroy(&el2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1316,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1317
1318 /* Start assembling */
1319 ierr = MatAssemblyBegin(T,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1319,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1320 if (pcbddc->nedcG) {
1321 ierr = MatAssemblyBegin(pcbddc->nedcG,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1321,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1322 }
1323
1324 /* Free */
1325 if (fl2g) {
1326 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1326,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1327 for (i=0;i<nee;i++) {
1328 ierr = ISDestroy(&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1328,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1329 }
1330 ierr = PetscFree(eedges)((*PetscTrFree)((void*)(eedges),1330,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eedges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1330,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1331 }
1332
1333 /* hack mat_graph with primal dofs on the coarse edges */
1334 {
1335 PCBDDCGraph graph = pcbddc->mat_graph;
1336 PetscInt *oqueue = graph->queue;
1337 PetscInt *ocptr = graph->cptr;
1338 PetscInt ncc,*idxs;
1339
1340 /* find first primal edge */
1341 if (pcbddc->nedclocal) {
1342 ierr = ISGetIndices(pcbddc->nedclocal,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1342,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1343 } else {
1344 if (fl2g) {
1345 ierr = ISLocalToGlobalMappingApply(fl2g,nee,cedges,cedges);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1346 }
1347 idxs = cedges;
1348 }
1349 cum = 0;
1350 while (cum < nee && cedges[cum] < 0) cum++;
1351
1352 /* adapt connected components */
1353 ierr = PetscMalloc2(graph->nvtxs+1,&graph->cptr,ocptr[graph->ncc],&graph->queue)PetscMallocA(2,PETSC_FALSE,1353,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(graph->nvtxs+1)*sizeof(**(&graph->cptr)),
(&graph->cptr),(size_t)(ocptr[graph->ncc])*sizeof(*
*(&graph->queue)),(&graph->queue))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1353,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1354 graph->cptr[0] = 0;
1355 for (i=0,ncc=0;i<graph->ncc;i++) {
1356 PetscInt lc = ocptr[i+1]-ocptr[i];
1357 if (cum != nee && oqueue[ocptr[i+1]-1] == cedges[cum]) { /* this cc has a primal dof */
1358 graph->cptr[ncc+1] = graph->cptr[ncc]+1;
1359 graph->queue[graph->cptr[ncc]] = cedges[cum];
1360 ncc++;
1361 lc--;
1362 cum++;
1363 while (cum < nee && cedges[cum] < 0) cum++;
1364 }
1365 graph->cptr[ncc+1] = graph->cptr[ncc] + lc;
1366 for (j=0;j<lc;j++) graph->queue[graph->cptr[ncc]+j] = oqueue[ocptr[i]+j];
1367 ncc++;
1368 }
1369 graph->ncc = ncc;
1370 if (pcbddc->nedclocal) {
1371 ierr = ISRestoreIndices(pcbddc->nedclocal,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1371,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1372 }
1373 ierr = PetscFree2(ocptr,oqueue)PetscFreeA(2,1373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(ocptr),&(oqueue))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1374 }
1375 ierr = ISLocalToGlobalMappingDestroy(&fl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1376 ierr = PCBDDCGraphRestoreCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),&nee,&alleedges,&allprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1377 ierr = PCBDDCGraphResetCSR(pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1378 ierr = MatDestroy(&conn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1378,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1379
1380 ierr = ISDestroy(&nedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1380,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1381 ierr = PetscFree(extrow)((*PetscTrFree)((void*)(extrow),1381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extrow) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1382 ierr = PetscFree2(work,rwork)PetscFreeA(2,1382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(work),&(rwork))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1383 ierr = PetscFree(corners)((*PetscTrFree)((void*)(corners),1383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((corners) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1384 ierr = PetscFree(cedges)((*PetscTrFree)((void*)(cedges),1384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((cedges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1385 ierr = PetscFree(extrows)((*PetscTrFree)((void*)(extrows),1385,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extrows) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1385,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1386 ierr = PetscFree(extcols)((*PetscTrFree)((void*)(extcols),1386,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extcols) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1386,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1387 ierr = MatDestroy(&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1387,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1388
1389 /* Complete assembling */
1390 ierr = MatAssemblyEnd(T,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1391 if (pcbddc->nedcG) {
1392 ierr = MatAssemblyEnd(pcbddc->nedcG,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1393#if 0
1394 ierr = PetscObjectSetName((PetscObject)pcbddc->nedcG,"coarse_G");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1394,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1395 ierr = MatView(pcbddc->nedcG,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1396#endif
1397 }
1398
1399 /* set change of basis */
1400 ierr = PCBDDCSetChangeOfBasisMat(pc,T,singular);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1400,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1401 ierr = MatDestroy(&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1401,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1402
1403 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1404}
1405
1406/* the near-null space of BDDC carries information on quadrature weights,
1407 and these can be collinear -> so cheat with MatNullSpaceCreate
1408 and create a suitable set of basis vectors first */
1409PetscErrorCode PCBDDCNullSpaceCreate(MPI_Comm comm, PetscBool has_const, PetscInt nvecs, Vec quad_vecs[], MatNullSpace *nnsp)
1410{
1411 PetscErrorCode ierr;
1412 PetscInt i;
1413
1414 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1414; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1415 for (i=0;i<nvecs;i++) {
1416 PetscInt first,last;
1417
1418 ierr = VecGetOwnershipRange(quad_vecs[i],&first,&last);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1418,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1419 if (last-first < 2*nvecs && has_const) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented")return PetscError(((MPI_Comm)0x44000001),1419,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not implemented")
;
1420 if (i>=first && i < last) {
1421 PetscScalar *data;
1422 ierr = VecGetArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1422,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1423 if (!has_const) {
1424 data[i-first] = 1.;
1425 } else {
1426 data[2*i-first] = 1./PetscSqrtReal(2.)sqrt(2.);
1427 data[2*i-first+1] = -1./PetscSqrtReal(2.)sqrt(2.);
1428 }
1429 ierr = VecRestoreArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1430 }
1431 ierr = PetscObjectStateIncrease((PetscObject)quad_vecs[i])(((PetscObject)quad_vecs[i])->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1432 }
1433 ierr = MatNullSpaceCreate(comm,has_const,nvecs,quad_vecs,nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1434 for (i=0;i<nvecs;i++) { /* reset vectors */
1435 PetscInt first,last;
1436 ierr = VecLockReadPop(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1436,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1437 ierr = VecGetOwnershipRange(quad_vecs[i],&first,&last);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1437,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1438 if (i>=first && i < last) {
1439 PetscScalar *data;
1440 ierr = VecGetArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1440,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1441 if (!has_const) {
1442 data[i-first] = 0.;
1443 } else {
1444 data[2*i-first] = 0.;
1445 data[2*i-first+1] = 0.;
1446 }
1447 ierr = VecRestoreArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1447,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1448 }
1449 ierr = PetscObjectStateIncrease((PetscObject)quad_vecs[i])(((PetscObject)quad_vecs[i])->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1449,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1450 ierr = VecLockReadPush(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1450,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1451 }
1452 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1453}
1454
1455PetscErrorCode PCBDDCComputeNoNetFlux(Mat A, Mat divudotp, PetscBool transpose, IS vl2l, PCBDDCGraph graph, MatNullSpace *nnsp)
1456{
1457 Mat loc_divudotp;
1458 Vec p,v,vins,quad_vec,*quad_vecs;
1459 ISLocalToGlobalMapping map;
1460 PetscScalar *vals;
1461 const PetscScalar *array;
1462 PetscInt i,maxneighs,maxsize,*gidxs;
1463 PetscInt n_neigh,*neigh,*n_shared,**shared;
1464 PetscMPIInt rank;
1465 PetscErrorCode ierr;
1466
1467 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1467; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1468 ierr = ISLocalToGlobalMappingGetInfo(graph->l2gmap,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1468,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1469 ierr = MPIU_Allreduce(&n_neigh,&maxneighs,1,MPIU_INT,MPI_MAX,PetscObjectComm((PetscObject)A))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)A),1
,1469,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)A))),0) || MPI_Allreduce((&n_neigh),(&maxneighs
),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm
((PetscObject)A)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1469,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1470 if (!maxneighs) {
1471 ierr = ISLocalToGlobalMappingRestoreInfo(graph->l2gmap,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1471,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1472 *nnsp = NULL((void*)0);
1473 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1474 }
1475 maxsize = 0;
1476 for (i=0;i<n_neigh;i++) maxsize = PetscMax(n_shared[i],maxsize)(((n_shared[i])<(maxsize)) ? (maxsize) : (n_shared[i]));
1477 ierr = PetscMalloc2(maxsize,&gidxs,maxsize,&vals)PetscMallocA(2,PETSC_FALSE,1477,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(maxsize)*sizeof(**(&gidxs)),(&gidxs),(size_t
)(maxsize)*sizeof(**(&vals)),(&vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1477,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1478 /* create vectors to hold quadrature weights */
1479 ierr = MatCreateVecs(A,&quad_vec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1479,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1480 if (!transpose) {
1481 ierr = MatGetLocalToGlobalMapping(A,&map,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1481,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1482 } else {
1483 ierr = MatGetLocalToGlobalMapping(A,NULL((void*)0),&map);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1483,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1484 }
1485 ierr = VecDuplicateVecs(quad_vec,maxneighs,&quad_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1486 ierr = VecDestroy(&quad_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1487 ierr = PCBDDCNullSpaceCreate(PetscObjectComm((PetscObject)A),PETSC_FALSE,maxneighs,quad_vecs,nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1488 for (i=0;i<maxneighs;i++) {
1489 ierr = VecLockReadPop(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1490 }
1491
1492 /* compute local quad vec */
1493 ierr = MatISGetLocalMat(divudotp,&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1494 if (!transpose) {
1495 ierr = MatCreateVecs(loc_divudotp,&v,&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1496 } else {
1497 ierr = MatCreateVecs(loc_divudotp,&p,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1498 }
1499 ierr = VecSet(p,1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1499,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1500 if (!transpose) {
1501 ierr = MatMultTranspose(loc_divudotp,p,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1501,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1502 } else {
1503 ierr = MatMult(loc_divudotp,p,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1503,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1504 }
1505 if (vl2l) {
1506 Mat lA;
1507 VecScatter sc;
1508
1509 ierr = MatISGetLocalMat(A,&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1510 ierr = MatCreateVecs(lA,&vins,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1511 ierr = VecScatterCreate(v,NULL((void*)0),vins,vl2l,&sc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1512 ierr = VecScatterBegin(sc,v,vins,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1513 ierr = VecScatterEnd(sc,v,vins,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1513,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1514 ierr = VecScatterDestroy(&sc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1514,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1515 } else {
1516 vins = v;
1517 }
1518 ierr = VecGetArrayRead(vins,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1518,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1519 ierr = VecDestroy(&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1519,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1520
1521 /* insert in global quadrature vecs */
1522 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1523 for (i=0;i<n_neigh;i++) {
1524 const PetscInt *idxs;
1525 PetscInt idx,nn,j;
1526
1527 idxs = shared[i];
1528 nn = n_shared[i];
1529 for (j=0;j<nn;j++) vals[j] = array[idxs[j]];
1530 ierr = PetscFindInt(rank,graph->count[idxs[0]],graph->neighbours_set[idxs[0]],&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1530,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1531 idx = -(idx+1);
1532 ierr = ISLocalToGlobalMappingApply(map,nn,idxs,gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1532,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1533 ierr = VecSetValues(quad_vecs[idx],nn,gidxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1533,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1534 }
1535 ierr = ISLocalToGlobalMappingRestoreInfo(graph->l2gmap,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1535,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1536 ierr = VecRestoreArrayRead(vins,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1537 if (vl2l) {
1538 ierr = VecDestroy(&vins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1538,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1539 }
1540 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1540,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1541 ierr = PetscFree2(gidxs,vals)PetscFreeA(2,1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(gidxs),&(vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1542
1543 /* assemble near null space */
1544 for (i=0;i<maxneighs;i++) {
1545 ierr = VecAssemblyBegin(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1545,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1546 }
1547 for (i=0;i<maxneighs;i++) {
1548 ierr = VecAssemblyEnd(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1548,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1549 ierr = VecViewFromOptions(quad_vecs[i],NULL((void*)0),"-pc_bddc_quad_vecs_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1549,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1550 ierr = VecLockReadPush(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1550,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1551 }
1552 ierr = VecDestroyVecs(maxneighs,&quad_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1553 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1554}
1555
1556PetscErrorCode PCBDDCAddPrimalVerticesLocalIS(PC pc, IS primalv)
1557{
1558 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
1559 PetscErrorCode ierr;
1560
1561 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1561; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1562 if (primalv) {
1563 if (pcbddc->user_primal_vertices_local) {
1564 IS list[2], newp;
1565
1566 list[0] = primalv;
1567 list[1] = pcbddc->user_primal_vertices_local;
1568 ierr = ISConcatenate(PetscObjectComm((PetscObject)pc),2,list,&newp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1568,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1569 ierr = ISSortRemoveDups(newp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1570 ierr = ISDestroy(&list[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1570,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1571 pcbddc->user_primal_vertices_local = newp;
1572 } else {
1573 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1574 }
1575 }
1576 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1577}
1578
1579static PetscErrorCode func_coords_private(PetscInt dim, PetscReal t, const PetscReal X[], PetscInt Nf, PetscScalar *out, void *ctx)
1580{
1581 PetscInt f, *comp = (PetscInt *)ctx;
1582
1583 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1583; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1584 for (f=0;f<Nf;f++) out[f] = X[*comp];
1585 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1586}
1587
1588PetscErrorCode PCBDDCComputeLocalTopologyInfo(PC pc)
1589{
1590 PetscErrorCode ierr;
1591 Vec local,global;
1592 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
1593 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
1594 PetscBool monolithic = PETSC_FALSE;
1595
1596 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1596; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1597 ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)pc),((PetscObject)pc)->prefix,"BDDC topology options","PC")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)pc),((PetscObject)pc)->prefix,"BDDC topology options"
,"PC");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),1597,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1597,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1598 ierr = PetscOptionsBool("-pc_bddc_monolithic","Discard any information on dofs splitting",NULL,monolithic,&monolithic,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-pc_bddc_monolithic"
,"Discard any information on dofs splitting",((void*)0),monolithic
,&monolithic,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1598,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1599 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1600 /* need to convert from global to local topology information and remove references to information in global ordering */
1601 ierr = MatCreateVecs(pc->pmat,&global,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1601,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1602 ierr = MatCreateVecs(matis->A,&local,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1602,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1603 if (monolithic) { /* just get block size to properly compute vertices */
1604 if (pcbddc->vertex_size == 1) {
1605 ierr = MatGetBlockSize(pc->pmat,&pcbddc->vertex_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1605,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1606 }
1607 goto boundary;
1608 }
1609
1610 if (pcbddc->user_provided_isfordofs) {
1611 if (pcbddc->n_ISForDofs) {
1612 PetscInt i;
1613
1614 ierr = PetscMalloc1(pcbddc->n_ISForDofs,&pcbddc->ISForDofsLocal)PetscMallocA(1,PETSC_FALSE,1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->n_ISForDofs)*sizeof(**(&pcbddc->ISForDofsLocal
)),(&pcbddc->ISForDofsLocal))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1615 for (i=0;i<pcbddc->n_ISForDofs;i++) {
1616 PetscInt bs;
1617
1618 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,pcbddc->ISForDofs[i],&pcbddc->ISForDofsLocal[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1619 ierr = ISGetBlockSize(pcbddc->ISForDofs[i],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1619,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1620 ierr = ISSetBlockSize(pcbddc->ISForDofsLocal[i],bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1621 ierr = ISDestroy(&pcbddc->ISForDofs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1621,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1622 }
1623 pcbddc->n_ISForDofsLocal = pcbddc->n_ISForDofs;
1624 pcbddc->n_ISForDofs = 0;
1625 ierr = PetscFree(pcbddc->ISForDofs)((*PetscTrFree)((void*)(pcbddc->ISForDofs),1625,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->ISForDofs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1625,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1626 }
1627 } else {
1628 if (!pcbddc->n_ISForDofsLocal) { /* field split not present */
1629 DM dm;
1630
1631 ierr = MatGetDM(pc->pmat, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1631,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1632 if (!dm) {
1633 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1633,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1634 }
1635 if (dm) {
1636 IS *fields;
1637 PetscInt nf,i;
1638
1639 ierr = DMCreateFieldDecomposition(dm,&nf,NULL((void*)0),&fields,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1640 ierr = PetscMalloc1(nf,&pcbddc->ISForDofsLocal)PetscMallocA(1,PETSC_FALSE,1640,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nf)*sizeof(**(&pcbddc->ISForDofsLocal)),(&
pcbddc->ISForDofsLocal))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1640,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1641 for (i=0;i<nf;i++) {
1642 PetscInt bs;
1643
1644 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,fields[i],&pcbddc->ISForDofsLocal[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1645 ierr = ISGetBlockSize(fields[i],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1645,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1646 ierr = ISSetBlockSize(pcbddc->ISForDofsLocal[i],bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1647 ierr = ISDestroy(&fields[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1648 }
1649 ierr = PetscFree(fields)((*PetscTrFree)((void*)(fields),1649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((fields) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1650 pcbddc->n_ISForDofsLocal = nf;
1651 } else { /* See if MATIS has fields attached by the conversion from MatNest */
1652 PetscContainer c;
1653
1654 ierr = PetscObjectQuery((PetscObject)pc->pmat,"_convert_nest_lfields",(PetscObject*)&c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1655 if (c) {
1656 MatISLocalFields lf;
1657 ierr = PetscContainerGetPointer(c,(void**)&lf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1657,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1658 ierr = PCBDDCSetDofsSplittingLocal(pc,lf->nr,lf->rf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1658,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1659 } else { /* fallback, create the default fields if bs > 1 */
1660 PetscInt i, n = matis->A->rmap->n;
1661 ierr = MatGetBlockSize(pc->pmat,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1661,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1662 if (i > 1) {
1663 pcbddc->n_ISForDofsLocal = i;
1664 ierr = PetscMalloc1(pcbddc->n_ISForDofsLocal,&pcbddc->ISForDofsLocal)PetscMallocA(1,PETSC_FALSE,1664,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->n_ISForDofsLocal)*sizeof(**(&pcbddc->
ISForDofsLocal)),(&pcbddc->ISForDofsLocal))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1664,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1665 for (i=0;i<pcbddc->n_ISForDofsLocal;i++) {
1666 ierr = ISCreateStride(PetscObjectComm((PetscObject)pc),n/pcbddc->n_ISForDofsLocal,i,pcbddc->n_ISForDofsLocal,&pcbddc->ISForDofsLocal[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1666,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1667 }
1668 }
1669 }
1670 }
1671 } else {
1672 PetscInt i;
1673 for (i=0;i<pcbddc->n_ISForDofsLocal;i++) {
1674 ierr = PCBDDCConsistencyCheckIS(pc,MPI_LAND(MPI_Op)(0x58000005),&pcbddc->ISForDofsLocal[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1675 }
1676 }
1677 }
1678
1679boundary:
1680 if (!pcbddc->DirichletBoundariesLocal && pcbddc->DirichletBoundaries) {
1681 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,pcbddc->DirichletBoundaries,&pcbddc->DirichletBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1682 } else if (pcbddc->DirichletBoundariesLocal) {
1683 ierr = PCBDDCConsistencyCheckIS(pc,MPI_LAND(MPI_Op)(0x58000005),&pcbddc->DirichletBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1683,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1684 }
1685 if (!pcbddc->NeumannBoundariesLocal && pcbddc->NeumannBoundaries) {
1686 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,pcbddc->NeumannBoundaries,&pcbddc->NeumannBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1686,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1687 } else if (pcbddc->NeumannBoundariesLocal) {
1688 ierr = PCBDDCConsistencyCheckIS(pc,MPI_LOR(MPI_Op)(0x58000007),&pcbddc->NeumannBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1689 }
1690 if (!pcbddc->user_primal_vertices_local && pcbddc->user_primal_vertices) {
1691 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,pcbddc->user_primal_vertices,&pcbddc->user_primal_vertices_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1691,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1692 }
1693 ierr = VecDestroy(&global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1694 ierr = VecDestroy(&local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1694,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1695 /* detect local disconnected subdomains if requested (use matis->A) */
1696 if (pcbddc->detect_disconnected) {
1697 IS primalv = NULL((void*)0);
1698 PetscInt i;
1699 PetscBool filter = pcbddc->detect_disconnected_filter;
1700
1701 for (i=0;i<pcbddc->n_local_subs;i++) {
1702 ierr = ISDestroy(&pcbddc->local_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1702,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1703 }
1704 ierr = PetscFree(pcbddc->local_subs)((*PetscTrFree)((void*)(pcbddc->local_subs),1704,__func__,
"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->local_subs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1705 ierr = PCBDDCDetectDisconnectedComponents(pc,filter,&pcbddc->n_local_subs,&pcbddc->local_subs,&primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1706 ierr = PCBDDCAddPrimalVerticesLocalIS(pc,primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1707 ierr = ISDestroy(&primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1707,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1708 }
1709 /* early stage corner detection */
1710 {
1711 DM dm;
1712
1713 ierr = MatGetDM(pc->pmat,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1714 if (!dm) {
1715 ierr = PCGetDM(pc,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1716 }
1717 if (dm) {
1718 PetscBool isda;
1719
1720 ierr = PetscObjectTypeCompare((PetscObject)dm,DMDA"da",&isda);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1720,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1721 if (isda) {
1722 ISLocalToGlobalMapping l2l;
1723 IS corners;
1724 Mat lA;
1725 PetscBool gl,lo;
1726
1727 {
1728 Vec cvec;
1729 const PetscScalar *coords;
1730 PetscInt dof,n,cdim;
1731 PetscBool memc = PETSC_TRUE;
1732
1733 ierr = DMDAGetInfo(dm,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&dof,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1733,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1734 ierr = DMGetCoordinates(dm,&cvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1735 ierr = VecGetLocalSize(cvec,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1735,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1736 ierr = VecGetBlockSize(cvec,&cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1736,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1737 n /= cdim;
1738 ierr = PetscFree(pcbddc->mat_graph->coords)((*PetscTrFree)((void*)(pcbddc->mat_graph->coords),1738
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->mat_graph->coords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1738,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1739 ierr = PetscMalloc1(dof*n*cdim,&pcbddc->mat_graph->coords)PetscMallocA(1,PETSC_FALSE,1739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(dof*n*cdim)*sizeof(**(&pcbddc->mat_graph->
coords)),(&pcbddc->mat_graph->coords))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1740 ierr = VecGetArrayRead(cvec,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1740,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1741#if defined(PETSC_USE_COMPLEX)
1742 memc = PETSC_FALSE;
1743#endif
1744 if (dof != 1) memc = PETSC_FALSE;
1745 if (memc) {
1746 ierr = PetscMemcpy(pcbddc->mat_graph->coords,coords,cdim*n*dof*sizeof(PetscReal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1747 } else { /* BDDC graph does not use any blocked information, we need to replicate the data */
1748 PetscReal *bcoords = pcbddc->mat_graph->coords;
1749 PetscInt i, b, d;
1750
1751 for (i=0;i<n;i++) {
1752 for (b=0;b<dof;b++) {
1753 for (d=0;d<cdim;d++) {
1754 bcoords[i*dof*cdim + b*cdim + d] = PetscRealPart(coords[i*cdim+d])(coords[i*cdim+d]);
1755 }
1756 }
1757 }
1758 }
1759 ierr = VecRestoreArrayRead(cvec,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1759,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1760 pcbddc->mat_graph->cdim = cdim;
1761 pcbddc->mat_graph->cnloc = dof*n;
1762 pcbddc->mat_graph->cloc = PETSC_FALSE;
1763 }
1764 ierr = DMDAGetSubdomainCornersIS(dm,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1764,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1765 ierr = MatISGetLocalMat(pc->pmat,&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1765,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1766 ierr = MatGetLocalToGlobalMapping(lA,&l2l,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1766,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1767 ierr = MatISRestoreLocalMat(pc->pmat,&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1767,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1768 lo = (PetscBool)(l2l && corners);
1769 ierr = MPIU_Allreduce(&lo,&gl,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,1769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&lo),(&gl),(
1),(MPIU_BOOL),((MPI_Op)(0x58000005)),(PetscObjectComm((PetscObject
)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1770 if (gl) { /* From PETSc's DMDA */
1771 const PetscInt *idx;
1772 PetscInt dof,bs,*idxout,n;
1773
1774 ierr = DMDAGetInfo(dm,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&dof,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1774,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1775 ierr = ISLocalToGlobalMappingGetBlockSize(l2l,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1775,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1776 ierr = ISGetLocalSize(corners,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1776,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1777 ierr = ISGetIndices(corners,&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1777,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1778 if (bs == dof) {
1779 ierr = PetscMalloc1(n,&idxout)PetscMallocA(1,PETSC_FALSE,1779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&idxout)),(&idxout))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1780 ierr = ISLocalToGlobalMappingApplyBlock(l2l,n,idx,idxout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1780,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1781 } else { /* the original DMDA local-to-local map have been modified */
1782 PetscInt i,d;
1783
1784 ierr = PetscMalloc1(dof*n,&idxout)PetscMallocA(1,PETSC_FALSE,1784,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(dof*n)*sizeof(**(&idxout)),(&idxout))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1784,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1785 for (i=0;i<n;i++) for (d=0;d<dof;d++) idxout[dof*i+d] = dof*idx[i]+d;
1786 ierr = ISLocalToGlobalMappingApply(l2l,dof*n,idxout,idxout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1786,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1787
1788 bs = 1;
1789 n *= dof;
1790 }
1791 ierr = ISRestoreIndices(corners,&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1791,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1792 ierr = DMDARestoreSubdomainCornersIS(dm,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1793 ierr = ISCreateBlock(PetscObjectComm((PetscObject)pc),bs,n,idxout,PETSC_OWN_POINTER,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1794 ierr = PCBDDCAddPrimalVerticesLocalIS(pc,corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1795 ierr = ISDestroy(&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1796 pcbddc->corner_selected = PETSC_TRUE;
1797 pcbddc->corner_selection = PETSC_TRUE;
1798 }
1799 if (corners) {
1800 ierr = DMDARestoreSubdomainCornersIS(dm,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1800,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1801 }
1802 }
1803 }
1804 }
1805 if (pcbddc->corner_selection && !pcbddc->mat_graph->cdim) {
1806 DM dm;
1807
1808 ierr = MatGetDM(pc->pmat,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1809 if (!dm) {
1810 ierr = PCGetDM(pc,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1810,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1811 }
1812 if (dm) { /* this can get very expensive, I need to find a faster alternative */
1813 Vec vcoords;
1814 PetscSection section;
1815 PetscReal *coords;
1816 PetscInt d,cdim,nl,nf,**ctxs;
1817 PetscErrorCode (**funcs)(PetscInt, PetscReal, const PetscReal *, PetscInt, PetscScalar *, void *);
1818
1819 ierr = DMGetCoordinateDim(dm,&cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1820 ierr = DMGetSection(dm,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1821 ierr = PetscSectionGetNumFields(section,&nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1822 ierr = DMCreateGlobalVector(dm,&vcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1822,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1823 ierr = VecGetLocalSize(vcoords,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1824 ierr = PetscMalloc1(nl*cdim,&coords)PetscMallocA(1,PETSC_FALSE,1824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nl*cdim)*sizeof(**(&coords)),(&coords))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1825 ierr = PetscMalloc2(nf,&funcs,nf,&ctxs)PetscMallocA(2,PETSC_FALSE,1825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nf)*sizeof(**(&funcs)),(&funcs),(size_t)(nf
)*sizeof(**(&ctxs)),(&ctxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1826 ierr = PetscMalloc1(nf,&ctxs[0])PetscMallocA(1,PETSC_FALSE,1826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nf)*sizeof(**(&ctxs[0])),(&ctxs[0]))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1827 for (d=0;d<nf;d++) funcs[d] = func_coords_private;
1828 for (d=1;d<nf;d++) ctxs[d] = ctxs[d-1] + 1;
1829 for (d=0;d<cdim;d++) {
1830 PetscInt i;
1831 const PetscScalar *v;
1832
1833 for (i=0;i<nf;i++) ctxs[i][0] = d;
1834 ierr = DMProjectFunction(dm,0.0,funcs,(void**)ctxs,INSERT_VALUES,vcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1835 ierr = VecGetArrayRead(vcoords,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1836 for (i=0;i<nl;i++) coords[i*cdim+d] = PetscRealPart(v[i])(v[i]);
1837 ierr = VecRestoreArrayRead(vcoords,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1837,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1838 }
1839 ierr = VecDestroy(&vcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1839,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1840 ierr = PCSetCoordinates(pc,cdim,nl,coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1840,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1841 ierr = PetscFree(coords)((*PetscTrFree)((void*)(coords),1841,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((coords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1841,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1842 ierr = PetscFree(ctxs[0])((*PetscTrFree)((void*)(ctxs[0]),1842,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ctxs[0]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1842,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1843 ierr = PetscFree2(funcs,ctxs)PetscFreeA(2,1843,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(funcs),&(ctxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1843,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1844 }
1845 }
1846 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1847}
1848
1849PetscErrorCode PCBDDCConsistencyCheckIS(PC pc, MPI_Op mop, IS *is)
1850{
1851 Mat_IS *matis = (Mat_IS*)(pc->pmat->data);
1852 PetscErrorCode ierr;
1853 IS nis;
1854 const PetscInt *idxs;
1855 PetscInt i,nd,n = matis->A->rmap->n,*nidxs,nnd;
1856 PetscBool *ld;
1857
1858 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1858; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1859 if (mop != MPI_LAND(MPI_Op)(0x58000005) && mop != MPI_LOR(MPI_Op)(0x58000007)) SETERRQ(PetscObjectComm((PetscObject)(pc)),PETSC_ERR_SUP,"Supported are MPI_LAND and MPI_LOR")return PetscError(PetscObjectComm((PetscObject)(pc)),1859,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Supported are MPI_LAND and MPI_LOR")
;
1860 if (mop == MPI_LAND(MPI_Op)(0x58000005)) {
1861 /* init rootdata with true */
1862 ld = (PetscBool*) matis->sf_rootdata;
1863 for (i=0;i<pc->pmat->rmap->n;i++) ld[i] = PETSC_TRUE;
1864 } else {
1865 ierr = PetscMemzero(matis->sf_rootdata,pc->pmat->rmap->n*sizeof(PetscBool));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1866 }
1867 ierr = PetscMemzero(matis->sf_leafdata,n*sizeof(PetscBool));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1868 ierr = ISGetLocalSize(*is,&nd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1869 ierr = ISGetIndices(*is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1870 ld = (PetscBool*) matis->sf_leafdata;
1871 for (i=0;i<nd;i++)
1872 if (-1 < idxs[i] && idxs[i] < n)
1873 ld[idxs[i]] = PETSC_TRUE;
1874 ierr = ISRestoreIndices(*is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1875 ierr = PetscSFReduceBegin(matis->sf,MPIU_BOOL,matis->sf_leafdata,matis->sf_rootdata,mop);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1876 ierr = PetscSFReduceEnd(matis->sf,MPIU_BOOL,matis->sf_leafdata,matis->sf_rootdata,mop);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1876,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1877 ierr = PetscSFBcastBegin(matis->sf,MPIU_BOOL,matis->sf_rootdata,matis->sf_leafdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1877,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1878 ierr = PetscSFBcastEnd(matis->sf,MPIU_BOOL,matis->sf_rootdata,matis->sf_leafdata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1878,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1879 if (mop == MPI_LAND(MPI_Op)(0x58000005)) {
1880 ierr = PetscMalloc1(nd,&nidxs)PetscMallocA(1,PETSC_FALSE,1880,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nd)*sizeof(**(&nidxs)),(&nidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1880,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1881 } else {
1882 ierr = PetscMalloc1(n,&nidxs)PetscMallocA(1,PETSC_FALSE,1882,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&nidxs)),(&nidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1882,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1883 }
1884 for (i=0,nnd=0;i<n;i++)
1885 if (ld[i])
1886 nidxs[nnd++] = i;
1887 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)(*is)),nnd,nidxs,PETSC_OWN_POINTER,&nis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1887,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1888 ierr = ISDestroy(is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1888,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1889 *is = nis;
1890 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1891}
1892
1893PetscErrorCode PCBDDCBenignRemoveInterior(PC pc,Vec r,Vec z)
1894{
1895 PC_IS *pcis = (PC_IS*)(pc->data);
1896 PC_BDDC *pcbddc = (PC_BDDC*)(pc->data);
1897 PetscErrorCode ierr;
1898
1899 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1899; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1900 if (!pcbddc->benign_have_null) {
1901 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1902 }
1903 if (pcbddc->ChangeOfBasisMatrix) {
1904 Vec swap;
1905
1906 ierr = MatMultTranspose(pcbddc->ChangeOfBasisMatrix,r,pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1907 swap = pcbddc->work_change;
1908 pcbddc->work_change = r;
1909 r = swap;
1910 }
1911 ierr = VecScatterBegin(pcis->global_to_D,r,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1911,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1912 ierr = VecScatterEnd(pcis->global_to_D,r,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1912,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1913 ierr = KSPSolve(pcbddc->ksp_D,pcis->vec1_D,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1913,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1914 ierr = KSPCheckSolve(pcbddc->ksp_D,pc,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1915 ierr = VecSet(z,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1915,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1916 ierr = VecScatterBegin(pcis->global_to_D,pcis->vec2_D,z,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1916,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1917 ierr = VecScatterEnd(pcis->global_to_D,pcis->vec2_D,z,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1918 if (pcbddc->ChangeOfBasisMatrix) {
1919 pcbddc->work_change = r;
1920 ierr = VecCopy(z,pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1921 ierr = MatMult(pcbddc->ChangeOfBasisMatrix,pcbddc->work_change,z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1922 }
1923 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1924}
1925
1926PetscErrorCode PCBDDCBenignMatMult_Private_Private(Mat A, Vec x, Vec y, PetscBool transpose)
1927{
1928 PCBDDCBenignMatMult_ctx ctx;
1929 PetscErrorCode ierr;
1930 PetscBool apply_right,apply_left,reset_x;
1931
1932 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1932; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1933 ierr = MatShellGetContext(A,&ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1934 if (transpose) {
1935 apply_right = ctx->apply_left;
1936 apply_left = ctx->apply_right;
1937 } else {
1938 apply_right = ctx->apply_right;
1939 apply_left = ctx->apply_left;
1940 }
1941 reset_x = PETSC_FALSE;
1942 if (apply_right) {
1943 const PetscScalar *ax;
1944 PetscInt nl,i;
1945
1946 ierr = VecGetLocalSize(x,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1946,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1947 ierr = VecGetArrayRead(x,&ax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1947,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1948 ierr = PetscMemcpy(ctx->work,ax,nl*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1948,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1949 ierr = VecRestoreArrayRead(x,&ax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1949,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1950 for (i=0;i<ctx->benign_n;i++) {
1951 PetscScalar sum,val;
1952 const PetscInt *idxs;
1953 PetscInt nz,j;
1954 ierr = ISGetLocalSize(ctx->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1954,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1955 ierr = ISGetIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1956 sum = 0.;
1957 if (ctx->apply_p0) {
1958 val = ctx->work[idxs[nz-1]];
1959 for (j=0;j<nz-1;j++) {
1960 sum += ctx->work[idxs[j]];
1961 ctx->work[idxs[j]] += val;
1962 }
1963 } else {
1964 for (j=0;j<nz-1;j++) {
1965 sum += ctx->work[idxs[j]];
1966 }
1967 }
1968 ctx->work[idxs[nz-1]] -= sum;
1969 ierr = ISRestoreIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1969,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1970 }
1971 ierr = VecPlaceArray(x,ctx->work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1972 reset_x = PETSC_TRUE;
1973 }
1974 if (transpose) {
1975 ierr = MatMultTranspose(ctx->A,x,y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1976 } else {
1977 ierr = MatMult(ctx->A,x,y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1977,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1978 }
1979 if (reset_x) {
1980 ierr = VecResetArray(x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1981 }
1982 if (apply_left) {
1983 PetscScalar *ay;
1984 PetscInt i;
1985
1986 ierr = VecGetArray(y,&ay);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1987 for (i=0;i<ctx->benign_n;i++) {
1988 PetscScalar sum,val;
1989 const PetscInt *idxs;
1990 PetscInt nz,j;
1991 ierr = ISGetLocalSize(ctx->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1991,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1992 ierr = ISGetIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1993 val = -ay[idxs[nz-1]];
1994 if (ctx->apply_p0) {
1995 sum = 0.;
1996 for (j=0;j<nz-1;j++) {
1997 sum += ay[idxs[j]];
1998 ay[idxs[j]] += val;
1999 }
2000 ay[idxs[nz-1]] += sum;
2001 } else {
2002 for (j=0;j<nz-1;j++) {
2003 ay[idxs[j]] += val;
2004 }
2005 ay[idxs[nz-1]] = 0.;
2006 }
2007 ierr = ISRestoreIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2007,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2008 }
2009 ierr = VecRestoreArray(y,&ay);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2009,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2010 }
2011 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2012}
2013
2014PetscErrorCode PCBDDCBenignMatMultTranspose_Private(Mat A, Vec x, Vec y)
2015{
2016 PetscErrorCode ierr;
2017
2018 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2018; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2019 ierr = PCBDDCBenignMatMult_Private_Private(A,x,y,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2019,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2020 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2021}
2022
2023PetscErrorCode PCBDDCBenignMatMult_Private(Mat A, Vec x, Vec y)
2024{
2025 PetscErrorCode ierr;
2026
2027 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2027; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2028 ierr = PCBDDCBenignMatMult_Private_Private(A,x,y,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2028,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2029 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2030}
2031
2032PetscErrorCode PCBDDCBenignShellMat(PC pc, PetscBool restore)
2033{
2034 PC_IS *pcis = (PC_IS*)pc->data;
2035 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
2036 PCBDDCBenignMatMult_ctx ctx;
2037 PetscErrorCode ierr;
2038
2039 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2039; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2040 if (!restore) {
2041 Mat A_IB,A_BI;
2042 PetscScalar *work;
2043 PCBDDCReuseSolvers reuse = pcbddc->sub_schurs ? pcbddc->sub_schurs->reuse_solver : NULL((void*)0);
2044
2045 if (pcbddc->benign_original_mat) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Benign original mat has not been restored")return PetscError(((MPI_Comm)0x44000001),2045,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Benign original mat has not been restored"
)
;
2046 if (!pcbddc->benign_change || !pcbddc->benign_n || pcbddc->benign_change_explicit) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2047 ierr = PetscMalloc1(pcis->n,&work)PetscMallocA(1,PETSC_FALSE,2047,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n)*sizeof(**(&work)),(&work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2047,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2048 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2048,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2049 ierr = MatSetSizes(A_IB,pcis->n-pcis->n_B,pcis->n_B,PETSC_DECIDE-1,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2050 ierr = MatSetType(A_IB,MATSHELL"shell");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2050,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2051 ierr = MatShellSetOperation(A_IB,MATOP_MULT,(void (*)(void))PCBDDCBenignMatMult_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2052 ierr = MatShellSetOperation(A_IB,MATOP_MULT_TRANSPOSE,(void (*)(void))PCBDDCBenignMatMultTranspose_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2052,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2053 ierr = PetscNew(&ctx)PetscMallocA(1,PETSC_TRUE,2053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(1)*sizeof(**((&ctx))),((&ctx)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2054 ierr = MatShellSetContext(A_IB,ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2054,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2055 ctx->apply_left = PETSC_TRUE;
2056 ctx->apply_right = PETSC_FALSE;
2057 ctx->apply_p0 = PETSC_FALSE;
2058 ctx->benign_n = pcbddc->benign_n;
2059 if (reuse) {
2060 ctx->benign_zerodiag_subs = reuse->benign_zerodiag_subs;
2061 ctx->free = PETSC_FALSE;
2062 } else { /* TODO: could be optimized for successive solves */
2063 ISLocalToGlobalMapping N_to_D;
2064 PetscInt i;
2065
2066 ierr = ISLocalToGlobalMappingCreateIS(pcis->is_I_local,&N_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2067 ierr = PetscMalloc1(pcbddc->benign_n,&ctx->benign_zerodiag_subs)PetscMallocA(1,PETSC_FALSE,2067,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->benign_n)*sizeof(**(&ctx->benign_zerodiag_subs
)),(&ctx->benign_zerodiag_subs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2067,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2068 for (i=0;i<pcbddc->benign_n;i++) {
2069 ierr = ISGlobalToLocalMappingApplyIS(N_to_D,IS_GTOLM_DROP,pcbddc->benign_zerodiag_subs[i],&ctx->benign_zerodiag_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2070 }
2071 ierr = ISLocalToGlobalMappingDestroy(&N_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2071,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2072 ctx->free = PETSC_TRUE;
2073 }
2074 ctx->A = pcis->A_IB;
2075 ctx->work = work;
2076 ierr = MatSetUp(A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2076,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2077 ierr = MatAssemblyBegin(A_IB,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2078 ierr = MatAssemblyEnd(A_IB,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2079 pcis->A_IB = A_IB;
2080
2081 /* A_BI as A_IB^T */
2082 ierr = MatCreateTranspose(A_IB,&A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2082,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2083 pcbddc->benign_original_mat = pcis->A_BI;
2084 pcis->A_BI = A_BI;
2085 } else {
2086 if (!pcbddc->benign_original_mat) {
2087 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2088 }
2089 ierr = MatShellGetContext(pcis->A_IB,&ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2089,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2090 ierr = MatDestroy(&pcis->A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2090,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2091 pcis->A_IB = ctx->A;
2092 ctx->A = NULL((void*)0);
2093 ierr = MatDestroy(&pcis->A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2094 pcis->A_BI = pcbddc->benign_original_mat;
2095 pcbddc->benign_original_mat = NULL((void*)0);
2096 if (ctx->free) {
2097 PetscInt i;
2098 for (i=0;i<ctx->benign_n;i++) {
2099 ierr = ISDestroy(&ctx->benign_zerodiag_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2099,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2100 }
2101 ierr = PetscFree(ctx->benign_zerodiag_subs)((*PetscTrFree)((void*)(ctx->benign_zerodiag_subs),2101,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ctx->benign_zerodiag_subs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2101,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2102 }
2103 ierr = PetscFree(ctx->work)((*PetscTrFree)((void*)(ctx->work),2103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ctx->work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2104 ierr = PetscFree(ctx)((*PetscTrFree)((void*)(ctx),2104,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ctx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2104,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2105 }
2106 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2107}
2108
2109/* used just in bddc debug mode */
2110PetscErrorCode PCBDDCBenignProject(PC pc, IS is1, IS is2, Mat *B)
2111{
2112 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
2113 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
2114 Mat An;
2115 PetscErrorCode ierr;
2116
2117 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2117; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2118 ierr = MatPtAP(matis->A,pcbddc->benign_change,MAT_INITIAL_MATRIX,2.0,&An);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2118,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2119 ierr = MatZeroRowsColumns(An,pcbddc->benign_n,pcbddc->benign_p0_lidx,1.0,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2119,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2120 if (is1) {
2121 ierr = MatCreateSubMatrix(An,is1,is2,MAT_INITIAL_MATRIX,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2121,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2122 ierr = MatDestroy(&An);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2122,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2123 } else {
2124 *B = An;
2125 }
2126 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2127}
2128
2129/* TODO: add reuse flag */
2130PetscErrorCode MatSeqAIJCompress(Mat A, Mat *B)
2131{
2132 Mat Bt;
2133 PetscScalar *a,*bdata;
2134 const PetscInt *ii,*ij;
2135 PetscInt m,n,i,nnz,*bii,*bij;
2136 PetscBool flg_row;
2137 PetscErrorCode ierr;
2138
2139 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2139; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2140 ierr = MatGetSize(A,&n,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2140,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2141 ierr = MatGetRowIJ(A,0,PETSC_FALSE,PETSC_FALSE,&n,&ii,&ij,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2141,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2142 ierr = MatSeqAIJGetArray(A,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2142,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2143 nnz = n;
2144 for (i=0;i<ii[n];i++) {
2145 if (PetscLikely(PetscAbsScalar(a[i]) > PETSC_SMALL)__builtin_expect(!!(PetscAbsScalar(a[i]) > 1.e-10),1)) nnz++;
2146 }
2147 ierr = PetscMalloc1(n+1,&bii)PetscMallocA(1,PETSC_FALSE,2147,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n+1)*sizeof(**(&bii)),(&bii))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2147,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2148 ierr = PetscMalloc1(nnz,&bij)PetscMallocA(1,PETSC_FALSE,2148,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nnz)*sizeof(**(&bij)),(&bij))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2148,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2149 ierr = PetscMalloc1(nnz,&bdata)PetscMallocA(1,PETSC_FALSE,2149,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nnz)*sizeof(**(&bdata)),(&bdata))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2149,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2150 nnz = 0;
2151 bii[0] = 0;
2152 for (i=0;i<n;i++) {
2153 PetscInt j;
2154 for (j=ii[i];j<ii[i+1];j++) {
2155 PetscScalar entry = a[j];
2156 if (PetscLikely(PetscAbsScalar(entry) > PETSC_SMALL)__builtin_expect(!!(PetscAbsScalar(entry) > 1.e-10),1) || (n == m && ij[j] == i)) {
2157 bij[nnz] = ij[j];
2158 bdata[nnz] = entry;
2159 nnz++;
2160 }
2161 }
2162 bii[i+1] = nnz;
2163 }
2164 ierr = MatSeqAIJRestoreArray(A,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2165 ierr = MatCreateSeqAIJWithArrays(PetscObjectComm((PetscObject)A),n,m,bii,bij,bdata,&Bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2166 ierr = MatRestoreRowIJ(A,0,PETSC_FALSE,PETSC_FALSE,&n,&ii,&ij,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2167 {
2168 Mat_SeqAIJ *b = (Mat_SeqAIJ*)(Bt->data);
2169 b->free_a = PETSC_TRUE;
2170 b->free_ij = PETSC_TRUE;
2171 }
2172 if (*B == A) {
2173 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2173,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2174 }
2175 *B = Bt;
2176 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2177}
2178
2179PetscErrorCode PCBDDCDetectDisconnectedComponents(PC pc, PetscBool filter, PetscInt *ncc, IS* cc[], IS* primalv)
2180{
2181 Mat B = NULL((void*)0);
2182 DM dm;
2183 IS is_dummy,*cc_n;
2184 ISLocalToGlobalMapping l2gmap_dummy;
2185 PCBDDCGraph graph;
2186 PetscInt *xadj_filtered = NULL((void*)0),*adjncy_filtered = NULL((void*)0);
2187 PetscInt i,n;
2188 PetscInt *xadj,*adjncy;
2189 PetscBool isplex = PETSC_FALSE;
2190 PetscErrorCode ierr;
2191
2192 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2192; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2193 if (ncc) *ncc = 0;
2194 if (cc) *cc = NULL((void*)0);
2195 if (primalv) *primalv = NULL((void*)0);
2196 ierr = PCBDDCGraphCreate(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2196,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2197 ierr = MatGetDM(pc->pmat,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2198 if (!dm) {
2199 ierr = PCGetDM(pc,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2200 }
2201 if (dm) {
2202 ierr = PetscObjectTypeCompare((PetscObject)dm,DMPLEX"plex",&isplex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2203 }
2204 if (filter) isplex = PETSC_FALSE;
2205
2206 if (isplex) { /* this code has been modified from plexpartition.c */
2207 PetscInt p, pStart, pEnd, a, adjSize, idx, size, nroots;
2208 PetscInt *adj = NULL((void*)0);
2209 IS cellNumbering;
2210 const PetscInt *cellNum;
2211 PetscBool useCone, useClosure;
2212 PetscSection section;
2213 PetscSegBuffer adjBuffer;
2214 PetscSF sfPoint;
2215 PetscErrorCode ierr;
2216
2217 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2217; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2218 ierr = DMPlexGetHeightStratum(dm, 0, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2219 ierr = DMGetPointSF(dm, &sfPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2220 ierr = PetscSFGetGraph(sfPoint, &nroots, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2220,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2221 /* Build adjacency graph via a section/segbuffer */
2222 ierr = PetscSectionCreate(PetscObjectComm((PetscObject) dm), &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2222,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2223 ierr = PetscSectionSetChart(section, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2224 ierr = PetscSegBufferCreate(sizeof(PetscInt),1000,&adjBuffer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2224,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2225 /* Always use FVM adjacency to create partitioner graph */
2226 ierr = DMGetBasicAdjacency(dm, &useCone, &useClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2226,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2227 ierr = DMSetBasicAdjacency(dm, PETSC_TRUE, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2227,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2228 ierr = DMPlexGetCellNumbering(dm, &cellNumbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2228,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2229 ierr = ISGetIndices(cellNumbering, &cellNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2229,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2230 for (n = 0, p = pStart; p < pEnd; p++) {
2231 /* Skip non-owned cells in parallel (ParMetis expects no overlap) */
2232 if (nroots > 0) {if (cellNum[p] < 0) continue;}
2233 adjSize = PETSC_DETERMINE-1;
2234 ierr = DMPlexGetAdjacency(dm, p, &adjSize, &adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2234,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2235 for (a = 0; a < adjSize; ++a) {
2236 const PetscInt point = adj[a];
2237 if (pStart <= point && point < pEnd) {
2238 PetscInt *PETSC_RESTRICT__restrict pBuf;
2239 ierr = PetscSectionAddDof(section, p, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2239,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2240 ierr = PetscSegBufferGetInts(adjBuffer, 1, &pBuf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2240,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2241 *pBuf = point;
2242 }
2243 }
2244 n++;
2245 }
2246 ierr = DMSetBasicAdjacency(dm, useCone, useClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2247 /* Derive CSR graph from section/segbuffer */
2248 ierr = PetscSectionSetUp(section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2249 ierr = PetscSectionGetStorageSize(section, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2250 ierr = PetscMalloc1(n+1, &xadj)PetscMallocA(1,PETSC_FALSE,2250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n+1)*sizeof(**(&xadj)),(&xadj))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2251 for (idx = 0, p = pStart; p < pEnd; p++) {
2252 if (nroots > 0) {if (cellNum[p] < 0) continue;}
2253 ierr = PetscSectionGetOffset(section, p, &(xadj[idx++]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2254 }
2255 xadj[n] = size;
2256 ierr = PetscSegBufferExtractAlloc(adjBuffer, &adjncy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2257 /* Clean up */
2258 ierr = PetscSegBufferDestroy(&adjBuffer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2258,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2259 ierr = PetscSectionDestroy(&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2260 ierr = PetscFree(adj)((*PetscTrFree)((void*)(adj),2260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2261 graph->xadj = xadj;
2262 graph->adjncy = adjncy;
2263 } else {
2264 Mat A;
2265 PetscBool isseqaij, flg_row;
2266
2267 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2268 if (!A->rmap->N || !A->cmap->N) {
2269 ierr = PCBDDCGraphDestroy(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2269,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2270 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2271 }
2272 ierr = PetscObjectTypeCompare((PetscObject)A,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2272,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2273 if (!isseqaij && filter) {
2274 PetscBool isseqdense;
2275
2276 ierr = PetscObjectTypeCompare((PetscObject)A,MATSEQDENSE"seqdense",&isseqdense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2276,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2277 if (!isseqdense) {
2278 ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2278,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2279 } else { /* TODO: rectangular case and LDA */
2280 PetscScalar *array;
2281 PetscReal chop=1.e-6;
2282
2283 ierr = MatDuplicate(A,MAT_COPY_VALUES,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2283,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2284 ierr = MatDenseGetArray(B,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2284,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2285 ierr = MatGetSize(B,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2285,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2286 for (i=0;i<n;i++) {
2287 PetscInt j;
2288 for (j=i+1;j<n;j++) {
2289 PetscReal thresh = chop*(PetscAbsScalar(array[i*(n+1)])+PetscAbsScalar(array[j*(n+1)]));
2290 if (PetscAbsScalar(array[i*n+j]) < thresh) array[i*n+j] = 0.;
2291 if (PetscAbsScalar(array[j*n+i]) < thresh) array[j*n+i] = 0.;
2292 }
2293 }
2294 ierr = MatDenseRestoreArray(B,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2294,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2295 ierr = MatConvert(B,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2296 }
2297 } else {
2298 ierr = PetscObjectReference((PetscObject)A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2299 B = A;
2300 }
2301 ierr = MatGetRowIJ(B,0,PETSC_TRUE,PETSC_FALSE,&n,(const PetscInt**)&xadj,(const PetscInt**)&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2302
2303 /* if filter is true, then removes entries lower than PETSC_SMALL in magnitude */
2304 if (filter) {
2305 PetscScalar *data;
2306 PetscInt j,cum;
2307
2308 ierr = PetscCalloc2(n+1,&xadj_filtered,xadj[n],&adjncy_filtered)PetscMallocA(2,PETSC_TRUE,2308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n+1)*sizeof(**(&xadj_filtered)),(&xadj_filtered
),(size_t)(xadj[n])*sizeof(**(&adjncy_filtered)),(&adjncy_filtered
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2309 ierr = MatSeqAIJGetArray(B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2309,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2310 cum = 0;
2311 for (i=0;i<n;i++) {
2312 PetscInt t;
2313
2314 for (j=xadj[i];j<xadj[i+1];j++) {
2315 if (PetscUnlikely(PetscAbsScalar(data[j]) < PETSC_SMALL)__builtin_expect(!!(PetscAbsScalar(data[j]) < 1.e-10),0)) {
2316 continue;
2317 }
2318 adjncy_filtered[cum+xadj_filtered[i]++] = adjncy[j];
2319 }
2320 t = xadj_filtered[i];
2321 xadj_filtered[i] = cum;
2322 cum += t;
2323 }
2324 ierr = MatSeqAIJRestoreArray(B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2324,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2325 graph->xadj = xadj_filtered;
2326 graph->adjncy = adjncy_filtered;
2327 } else {
2328 graph->xadj = xadj;
2329 graph->adjncy = adjncy;
2330 }
2331 }
2332 /* compute local connected components using PCBDDCGraph */
2333 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),n,0,1,&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2333,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2334 ierr = ISLocalToGlobalMappingCreateIS(is_dummy,&l2gmap_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2334,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2335 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2335,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2336 ierr = PCBDDCGraphInit(graph,l2gmap_dummy,n,PETSC_MAX_INT2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2337 ierr = ISLocalToGlobalMappingDestroy(&l2gmap_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2337,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2338 ierr = PCBDDCGraphSetUp(graph,1,NULL((void*)0),NULL((void*)0),0,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2338,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2339 ierr = PCBDDCGraphComputeConnectedComponents(graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2339,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2340
2341 /* partial clean up */
2342 ierr = PetscFree2(xadj_filtered,adjncy_filtered)PetscFreeA(2,2342,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(xadj_filtered),&(adjncy_filtered))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2342,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2343 if (B) {
2344 PetscBool flg_row;
2345 ierr = MatRestoreRowIJ(B,0,PETSC_TRUE,PETSC_FALSE,&n,(const PetscInt**)&xadj,(const PetscInt**)&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2346 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2346,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2347 }
2348 if (isplex) {
2349 ierr = PetscFree(xadj)((*PetscTrFree)((void*)(xadj),2349,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((xadj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2349,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2350 ierr = PetscFree(adjncy)((*PetscTrFree)((void*)(adjncy),2350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2351 }
2352
2353 /* get back data */
2354 if (isplex) {
2355 if (ncc) *ncc = graph->ncc;
2356 if (cc || primalv) {
2357 Mat A;
2358 PetscBT btv,btvt;
2359 PetscSection subSection;
2360 PetscInt *ids,cum,cump,*cids,*pids;
2361
2362 ierr = DMPlexGetSubdomainSection(dm,&subSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2362,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2363 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2364 ierr = PetscMalloc3(A->rmap->n,&ids,graph->ncc+1,&cids,A->rmap->n,&pids)PetscMallocA(3,PETSC_FALSE,2364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(A->rmap->n)*sizeof(**(&ids)),(&ids),(
size_t)(graph->ncc+1)*sizeof(**(&cids)),(&cids),(size_t
)(A->rmap->n)*sizeof(**(&pids)),(&pids))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2365 ierr = PetscBTCreate(A->rmap->n,&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2365,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2366 ierr = PetscBTCreate(A->rmap->n,&btvt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2366,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2367
2368 cids[0] = 0;
2369 for (i = 0, cump = 0, cum = 0; i < graph->ncc; i++) {
2370 PetscInt j;
2371
2372 ierr = PetscBTMemzero(A->rmap->n,btvt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2372,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2373 for (j = graph->cptr[i]; j < graph->cptr[i+1]; j++) {
2374 PetscInt k, size, *closure = NULL((void*)0), cell = graph->queue[j];
2375
2376 ierr = DMPlexGetTransitiveClosure(dm,cell,PETSC_TRUE,&size,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2377 for (k = 0; k < 2*size; k += 2) {
2378 PetscInt s, pp, p = closure[k], off, dof, cdof;
2379
2380 ierr = PetscSectionGetConstraintDof(subSection,p,&cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2380,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2381 ierr = PetscSectionGetOffset(subSection,p,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2382 ierr = PetscSectionGetDof(subSection,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2383 for (s = 0; s < dof-cdof; s++) {
2384 if (PetscBTLookupSet(btvt,off+s)) continue;
2385 if (!PetscBTLookup(btv,off+s)) {
2386 ids[cum++] = off+s;
2387 } else { /* cross-vertex */
2388 pids[cump++] = off+s;
2389 }
2390 }
2391 ierr = DMPlexGetTreeParent(dm,p,&pp,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2391,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2392 if (pp != p) {
2393 ierr = PetscSectionGetConstraintDof(subSection,pp,&cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2393,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2394 ierr = PetscSectionGetOffset(subSection,pp,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2394,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2395 ierr = PetscSectionGetDof(subSection,pp,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2396 for (s = 0; s < dof-cdof; s++) {
2397 if (PetscBTLookupSet(btvt,off+s)) continue;
2398 if (!PetscBTLookup(btv,off+s)) {
2399 ids[cum++] = off+s;
2400 } else { /* cross-vertex */
2401 pids[cump++] = off+s;
2402 }
2403 }
2404 }
2405 }
2406 ierr = DMPlexRestoreTransitiveClosure(dm,cell,PETSC_TRUE,&size,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2406,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2407 }
2408 cids[i+1] = cum;
2409 /* mark dofs as already assigned */
2410 for (j = cids[i]; j < cids[i+1]; j++) {
2411 ierr = PetscBTSet(btv,ids[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2411,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2412 }
2413 }
2414 if (cc) {
2415 ierr = PetscMalloc1(graph->ncc,&cc_n)PetscMallocA(1,PETSC_FALSE,2415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(graph->ncc)*sizeof(**(&cc_n)),(&cc_n))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2416 for (i = 0; i < graph->ncc; i++) {
2417 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),cids[i+1]-cids[i],ids+cids[i],PETSC_COPY_VALUES,&cc_n[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2418 }
2419 *cc = cc_n;
2420 }
2421 if (primalv) {
2422 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),cump,pids,PETSC_COPY_VALUES,primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2422,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2423 }
2424 ierr = PetscFree3(ids,cids,pids)PetscFreeA(3,2424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(ids),&(cids),&(pids))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2425 ierr = PetscBTDestroy(&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2425,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2426 ierr = PetscBTDestroy(&btvt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2426,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2427 }
2428 } else {
2429 if (ncc) *ncc = graph->ncc;
2430 if (cc) {
2431 ierr = PetscMalloc1(graph->ncc,&cc_n)PetscMallocA(1,PETSC_FALSE,2431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(graph->ncc)*sizeof(**(&cc_n)),(&cc_n))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2432 for (i=0;i<graph->ncc;i++) {
2433 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),graph->cptr[i+1]-graph->cptr[i],graph->queue+graph->cptr[i],PETSC_COPY_VALUES,&cc_n[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2434 }
2435 *cc = cc_n;
2436 }
2437 }
2438 /* clean up graph */
2439 graph->xadj = 0;
2440 graph->adjncy = 0;
2441 ierr = PCBDDCGraphDestroy(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2441,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2442 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2443}
2444
2445PetscErrorCode PCBDDCBenignCheck(PC pc, IS zerodiag)
2446{
2447 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
2448 PC_IS* pcis = (PC_IS*)(pc->data);
2449 IS dirIS = NULL((void*)0);
2450 PetscInt i;
2451 PetscErrorCode ierr;
2452
2453 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2453; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2454 ierr = PCBDDCGraphGetDirichletDofs(pcbddc->mat_graph,&dirIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2454,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2455 if (zerodiag) {
2456 Mat A;
2457 Vec vec3_N;
2458 PetscScalar *vals;
2459 const PetscInt *idxs;
2460 PetscInt nz,*count;
2461
2462 /* p0 */
2463 ierr = VecSet(pcis->vec1_N,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2464 ierr = PetscMalloc1(pcis->n,&vals)PetscMallocA(1,PETSC_FALSE,2464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n)*sizeof(**(&vals)),(&vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2465 ierr = ISGetLocalSize(zerodiag,&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2465,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2466 ierr = ISGetIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2466,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2467 for (i=0;i<nz;i++) vals[i] = 1.;
2468 ierr = VecSetValues(pcis->vec1_N,nz,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2468,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2469 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2469,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2470 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2470,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2471 /* v_I */
2472 ierr = VecSetRandom(pcis->vec2_N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2472,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2473 for (i=0;i<nz;i++) vals[i] = 0.;
2474 ierr = VecSetValues(pcis->vec2_N,nz,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2474,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2475 ierr = ISRestoreIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2475,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2476 ierr = ISGetIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2476,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2477 for (i=0;i<pcis->n_B;i++) vals[i] = 0.;
2478 ierr = VecSetValues(pcis->vec2_N,pcis->n_B,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2478,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2479 ierr = ISRestoreIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2479,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2480 if (dirIS) {
2481 PetscInt n;
2482
2483 ierr = ISGetLocalSize(dirIS,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2483,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2484 ierr = ISGetIndices(dirIS,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2484,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2485 for (i=0;i<n;i++) vals[i] = 0.;
2486 ierr = VecSetValues(pcis->vec2_N,n,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2487 ierr = ISRestoreIndices(dirIS,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2488 }
2489 ierr = VecAssemblyBegin(pcis->vec2_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2490 ierr = VecAssemblyEnd(pcis->vec2_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2490,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2491 ierr = VecDuplicate(pcis->vec1_N,&vec3_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2491,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2492 ierr = VecSet(vec3_N,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2492,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2493 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2494 ierr = MatMult(A,pcis->vec1_N,vec3_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2495 ierr = VecDot(vec3_N,pcis->vec2_N,&vals[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2496 if (PetscAbsScalar(vals[0]) > 1.e-1) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Benign trick can not be applied! b(v_I,p_0) = %1.6e (should be numerically 0.)",PetscAbsScalar(vals[0]))return PetscError(((MPI_Comm)0x44000001),2496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Benign trick can not be applied! b(v_I,p_0) = %1.6e (should be numerically 0.)"
,PetscAbsScalar(vals[0]))
;
2497 ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),2497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2498 ierr = VecDestroy(&vec3_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2498,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2499
2500 /* there should not be any pressure dofs lying on the interface */
2501 ierr = PetscCalloc1(pcis->n,&count)PetscMallocA(1,PETSC_TRUE,2501,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n)*sizeof(**(&count)),(&count))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2501,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2502 ierr = ISGetIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2502,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2503 for (i=0;i<pcis->n_B;i++) count[idxs[i]]++;
2504 ierr = ISRestoreIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2504,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2505 ierr = ISGetIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2505,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2506 for (i=0;i<nz;i++) if (count[idxs[i]]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Benign trick can not be applied! pressure dof %D is an interface dof",idxs[i])return PetscError(((MPI_Comm)0x44000001),2506,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Benign trick can not be applied! pressure dof %D is an interface dof"
,idxs[i])
;
2507 ierr = ISRestoreIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2507,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2508 ierr = PetscFree(count)((*PetscTrFree)((void*)(count),2508,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((count) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2508,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2509 }
2510 ierr = ISDestroy(&dirIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2511
2512 /* check PCBDDCBenignGetOrSetP0 */
2513 ierr = VecSetRandom(pcis->vec1_global,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2513,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2514 for (i=0;i<pcbddc->benign_n;i++) pcbddc->benign_p0[i] = -PetscGlobalRank-i;
2515 ierr = PCBDDCBenignGetOrSetP0(pc,pcis->vec1_global,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2515,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2516 for (i=0;i<pcbddc->benign_n;i++) pcbddc->benign_p0[i] = 1;
2517 ierr = PCBDDCBenignGetOrSetP0(pc,pcis->vec1_global,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2517,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2518 for (i=0;i<pcbddc->benign_n;i++) {
2519 PetscInt val = PetscRealPart(pcbddc->benign_p0[i])(pcbddc->benign_p0[i]);
2520 if (val != -PetscGlobalRank-i) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error testing PCBDDCBenignGetOrSetP0! Found %g at %D instead of %g",PetscRealPart(pcbddc->benign_p0[i]),i,-PetscGlobalRank-i)return PetscError(((MPI_Comm)0x44000001),2520,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error testing PCBDDCBenignGetOrSetP0! Found %g at %D instead of %g"
,(pcbddc->benign_p0[i]),i,-PetscGlobalRank-i)
;
2521 }
2522 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2523}
2524
2525PetscErrorCode PCBDDCBenignDetectSaddlePoint(PC pc, PetscBool reuse, IS *zerodiaglocal)
2526{
2527 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
2528 IS pressures = NULL((void*)0),zerodiag = NULL((void*)0),*bzerodiag = NULL((void*)0),zerodiag_save,*zerodiag_subs;
2529 PetscInt nz,n,benign_n,bsp = 1;
2530 PetscInt *interior_dofs,n_interior_dofs,nneu;
2531 PetscBool sorted,have_null,has_null_pressures,recompute_zerodiag,checkb;
2532 PetscErrorCode ierr;
2533
2534 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2534; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2535 if (reuse) goto project_b0;
1
Assuming 'reuse' is 0
2
Taking false branch
2536 ierr = PetscSFDestroy(&pcbddc->benign_sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2537 ierr = MatDestroy(&pcbddc->benign_B0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2537,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2538 for (n=0;n<pcbddc->benign_n;n++) {
3
Assuming the condition is false
4
Loop condition is false. Execution continues on line 2541
2539 ierr = ISDestroy(&pcbddc->benign_zerodiag_subs[n]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2539,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2540 }
2541 ierr = PetscFree(pcbddc->benign_zerodiag_subs)((*PetscTrFree)((void*)(pcbddc->benign_zerodiag_subs),2541
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->benign_zerodiag_subs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2542 has_null_pressures = PETSC_TRUE;
2543 have_null = PETSC_TRUE;
2544 /* if a local information on dofs is present, gets pressure dofs from command line (uses the last field is not provided)
2545 Without local information, it uses only the zerodiagonal dofs (ok if the pressure block is all zero and it is a scalar field)
2546 Checks if all the pressure dofs in each subdomain have a zero diagonal
2547 If not, a change of basis on pressures is not needed
2548 since the local Schur complements are already SPD
2549 */
2550 if (pcbddc->n_ISForDofsLocal) {
5
Assuming the condition is false
6
Taking false branch
2551 IS iP = NULL((void*)0);
2552 PetscInt p,*pp;
2553 PetscBool flg;
2554
2555 ierr = PetscMalloc1(pcbddc->n_ISForDofsLocal,&pp)PetscMallocA(1,PETSC_FALSE,2555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->n_ISForDofsLocal)*sizeof(**(&pp)),(&
pp))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2556 n = pcbddc->n_ISForDofsLocal;
2557 ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)pc),((PetscObject)pc)->prefix,"BDDC benign options","PC")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)pc),((PetscObject)pc)->prefix,"BDDC benign options"
,"PC");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),2557,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2557,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2558 ierr = PetscOptionsIntArray("-pc_bddc_pressure_field","Field id for pressures",NULL,pp,&n,&flg)PetscOptionsIntArray_Private(PetscOptionsObject,"-pc_bddc_pressure_field"
,"Field id for pressures",((void*)0),pp,&n,&flg)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2558,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2559 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2559,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2559,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2560 if (!flg) {
2561 n = 1;
2562 pp[0] = pcbddc->n_ISForDofsLocal-1;
2563 }
2564
2565 bsp = 0;
2566 for (p=0;p<n;p++) {
2567 PetscInt bs;
2568
2569 if (pp[p] < 0 || pp[p] > pcbddc->n_ISForDofsLocal-1) SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_USER,"Invalid field id for pressures %D",pp[p])return PetscError(PetscObjectComm((PetscObject)pc),2569,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Invalid field id for pressures %D",pp
[p])
;
2570 ierr = ISGetBlockSize(pcbddc->ISForDofsLocal[pp[p]],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2570,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2571 bsp += bs;
2572 }
2573 ierr = PetscMalloc1(bsp,&bzerodiag)PetscMallocA(1,PETSC_FALSE,2573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(bsp)*sizeof(**(&bzerodiag)),(&bzerodiag))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2574 bsp = 0;
2575 for (p=0;p<n;p++) {
2576 const PetscInt *idxs;
2577 PetscInt b,bs,npl,*bidxs;
2578
2579 ierr = ISGetBlockSize(pcbddc->ISForDofsLocal[pp[p]],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2579,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2580 ierr = ISGetLocalSize(pcbddc->ISForDofsLocal[pp[p]],&npl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2580,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2581 ierr = ISGetIndices(pcbddc->ISForDofsLocal[pp[p]],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2581,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2582 ierr = PetscMalloc1(npl/bs,&bidxs)PetscMallocA(1,PETSC_FALSE,2582,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(npl/bs)*sizeof(**(&bidxs)),(&bidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2582,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2583 for (b=0;b<bs;b++) {
2584 PetscInt i;
2585
2586 for (i=0;i<npl/bs;i++) bidxs[i] = idxs[bs*i+b];
2587 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),npl/bs,bidxs,PETSC_COPY_VALUES,&bzerodiag[bsp]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2588 bsp++;
2589 }
2590 ierr = PetscFree(bidxs)((*PetscTrFree)((void*)(bidxs),2590,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((bidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2590,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2591 ierr = ISRestoreIndices(pcbddc->ISForDofsLocal[pp[p]],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2592 }
2593 ierr = ISConcatenate(PETSC_COMM_SELF((MPI_Comm)0x44000001),bsp,bzerodiag,&pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2593,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2594
2595 /* remove zeroed out pressures if we are setting up a BDDC solver for a saddle-point FETI-DP */
2596 ierr = PetscObjectQuery((PetscObject)pc,"__KSPFETIDP_lP",(PetscObject*)&iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2596,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2597 if (iP) {
2598 IS newpressures;
2599
2600 ierr = ISDifference(pressures,iP,&newpressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2600,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2601 ierr = ISDestroy(&pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2601,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2602 pressures = newpressures;
2603 }
2604 ierr = ISSorted(pressures,&sorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2604,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2605 if (!sorted) {
2606 ierr = ISSort(pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2606,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2607 }
2608 ierr = PetscFree(pp)((*PetscTrFree)((void*)(pp),2608,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2608,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2609 }
2610
2611 /* pcis has not been setup yet, so get the local size from the subdomain matrix */
2612 ierr = MatGetLocalSize(pcbddc->local_mat,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2612,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2613 if (!n) pcbddc->benign_change_explicit = PETSC_TRUE;
7
Assuming 'n' is not equal to 0
8
Taking false branch
2614 ierr = MatFindZeroDiagonals(pcbddc->local_mat,&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2614,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2615 ierr = ISSorted(zerodiag,&sorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2615,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2616 if (!sorted) {
9
Assuming 'sorted' is not equal to 0
10
Taking false branch
2617 ierr = ISSort(zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2617,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2618 }
2619 ierr = PetscObjectReference((PetscObject)zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2619,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2620 zerodiag_save = zerodiag;
2621 ierr = ISGetLocalSize(zerodiag,&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2621,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2622 if (!nz) {
11
Assuming 'nz' is not equal to 0
12
Taking false branch
2623 if (n) have_null = PETSC_FALSE;
2624 has_null_pressures = PETSC_FALSE;
2625 ierr = ISDestroy(&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2625,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2626 }
2627 recompute_zerodiag = PETSC_FALSE;
2628
2629 /* in case disconnected subdomains info is present, split the pressures accordingly (otherwise the benign trick could fail) */
2630 zerodiag_subs = NULL((void*)0);
2631 benign_n = 0;
2632 n_interior_dofs = 0;
2633 interior_dofs = NULL((void*)0);
2634 nneu = 0;
2635 if (pcbddc->NeumannBoundariesLocal) {
13
Assuming the condition is false
14
Taking false branch
2636 ierr = ISGetLocalSize(pcbddc->NeumannBoundariesLocal,&nneu);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2637 }
2638 checkb = (PetscBool)(!pcbddc->NeumannBoundariesLocal || pcbddc->current_level);
2639 if (checkb) { /* need to compute interior nodes */
15
Taking true branch
2640 PetscInt n,i,j;
2641 PetscInt n_neigh,*neigh,*n_shared,**shared;
2642 PetscInt *iwork;
2643
2644 ierr = ISLocalToGlobalMappingGetSize(pc->pmat->rmap->mapping,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2645 ierr = ISLocalToGlobalMappingGetInfo(pc->pmat->rmap->mapping,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2645,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2646 ierr = PetscCalloc1(n,&iwork)PetscMallocA(1,PETSC_TRUE,2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&iwork)),(&iwork))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2647 ierr = PetscMalloc1(n,&interior_dofs)PetscMallocA(1,PETSC_FALSE,2647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&interior_dofs)),(&interior_dofs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2648 for (i=1;i<n_neigh;i++)
16
Assuming 'i' is >= 'n_neigh'
17
Loop condition is false. Execution continues on line 2651
2649 for (j=0;j<n_shared[i];j++)
2650 iwork[shared[i][j]] += 1;
2651 for (i=0;i<n;i++)
18
Assuming 'i' is >= 'n'
19
Loop condition is false. Execution continues on line 2654
2652 if (!iwork[i])
2653 interior_dofs[n_interior_dofs++] = i;
2654 ierr = PetscFree(iwork)((*PetscTrFree)((void*)(iwork),2654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((iwork) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2655 ierr = ISLocalToGlobalMappingRestoreInfo(pc->pmat->rmap->mapping,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2656 }
2657 if (has_null_pressures) {
20
Taking true branch
2658 IS *subs;
2659 PetscInt nsubs,i,j,nl;
2660 const PetscInt *idxs;
2661 PetscScalar *array;
2662 Vec *work;
2663 Mat_IS* matis = (Mat_IS*)(pc->pmat->data);
2664
2665 subs = pcbddc->local_subs;
21
Value assigned to 'subs'
2666 nsubs = pcbddc->n_local_subs;
2667 /* these vectors are needed to check if the constant on pressures is in the kernel of the local operator B (i.e. B(v_I,p0) should be zero) */
2668 if (checkb) {
22
Taking true branch
2669 ierr = VecDuplicateVecs(matis->y,2,&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2669,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2670 ierr = ISGetLocalSize(zerodiag,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2670,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2671 ierr = ISGetIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2671,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2672 /* work[0] = 1_p */
2673 ierr = VecSet(work[0],0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2674 ierr = VecGetArray(work[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2675 for (j=0;j<nl;j++) array[idxs[j]] = 1.;
23
Assuming 'j' is >= 'nl'
24
Loop condition is false. Execution continues on line 2676
2676 ierr = VecRestoreArray(work[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2677 /* work[0] = 1_v */
2678 ierr = VecSet(work[1],1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2679 ierr = VecGetArray(work[1],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2679,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2680 for (j=0;j<nl;j++) array[idxs[j]] = 0.;
25
Loop condition is false. Execution continues on line 2681
2681 ierr = VecRestoreArray(work[1],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2682 ierr = ISRestoreIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2682,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2683 }
2684
2685 if (nsubs > 1 || bsp > 1) {
26
Assuming 'nsubs' is > 1
2686 IS *is;
2687 PetscInt b,totb;
2688
2689 totb = bsp;
2690 is = bsp > 1 ? bzerodiag : &zerodiag;
27
'?' condition is false
2691 nsubs = PetscMax(nsubs,1)(((nsubs)<(1)) ? (1) : (nsubs));
2692 ierr = PetscCalloc1(nsubs*totb,&zerodiag_subs)PetscMallocA(1,PETSC_TRUE,2692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nsubs*totb)*sizeof(**(&zerodiag_subs)),(&zerodiag_subs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2693 for (b=0;b<totb;b++) {
28
Loop condition is true. Entering loop body
2694 for (i=0;i<nsubs;i++) {
29
Loop condition is true. Entering loop body
2695 ISLocalToGlobalMapping l2g;
2696 IS t_zerodiag_subs;
2697 PetscInt nl;
2698
2699 if (subs) {
30
Assuming 'subs' is null
31
Taking false branch
2700 ierr = ISLocalToGlobalMappingCreateIS(subs[i],&l2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2700,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2701 } else {
2702 IS tis;
2703
2704 ierr = MatGetLocalSize(pcbddc->local_mat,&nl,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2705 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),nl,0,1,&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2706 ierr = ISLocalToGlobalMappingCreateIS(tis,&l2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2707 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2707,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2708 }
2709 ierr = ISGlobalToLocalMappingApplyIS(l2g,IS_GTOLM_DROP,is[b],&t_zerodiag_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2709,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2710 ierr = ISGetLocalSize(t_zerodiag_subs,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2710,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2711 if (nl) {
32
Assuming 'nl' is not equal to 0
33
Taking true branch
2712 PetscBool valid = PETSC_TRUE;
2713
2714 if (checkb) {
34
Taking true branch
2715 ierr = VecSet(matis->x,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2716 ierr = ISGetLocalSize(subs[i],&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2716,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
35
Array access (from variable 'subs') results in a null pointer dereference
2717 ierr = ISGetIndices(subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2718 ierr = VecGetArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2719 for (j=0;j<nl;j++) array[idxs[j]] = 1.;
2720 ierr = VecRestoreArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2720,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2721 ierr = ISRestoreIndices(subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2721,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2722 ierr = VecPointwiseMult(matis->x,work[0],matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2722,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2723 ierr = MatMult(matis->A,matis->x,matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2723,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2724 ierr = VecPointwiseMult(matis->y,work[1],matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2724,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2725 ierr = VecGetArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2725,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2726 for (j=0;j<n_interior_dofs;j++) {
2727 if (PetscAbsScalar(array[interior_dofs[j]]) > PETSC_SMALL1.e-10) {
2728 valid = PETSC_FALSE;
2729 break;
2730 }
2731 }
2732 ierr = VecRestoreArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2732,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2733 }
2734 if (valid && nneu) {
2735 const PetscInt *idxs;
2736 PetscInt nzb;
2737
2738 ierr = ISGetIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2738,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2739 ierr = ISGlobalToLocalMappingApply(l2g,IS_GTOLM_DROP,nneu,idxs,&nzb,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2740 ierr = ISRestoreIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2740,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2741 if (nzb) valid = PETSC_FALSE;
2742 }
2743 if (valid && pressures) {
2744 IS t_pressure_subs,tmp;
2745 PetscInt i1,i2;
2746
2747 ierr = ISGlobalToLocalMappingApplyIS(l2g,IS_GTOLM_DROP,pressures,&t_pressure_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2748 ierr = ISEmbed(t_zerodiag_subs,t_pressure_subs,PETSC_TRUE,&tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2749 ierr = ISGetLocalSize(tmp,&i1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2750 ierr = ISGetLocalSize(t_zerodiag_subs,&i2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2751 if (i2 != i1) valid = PETSC_FALSE;
2752 ierr = ISDestroy(&t_pressure_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2753 ierr = ISDestroy(&tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2753,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2754 }
2755 if (valid) {
2756 ierr = ISLocalToGlobalMappingApplyIS(l2g,t_zerodiag_subs,&zerodiag_subs[benign_n]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2756,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2757 benign_n++;
2758 } else recompute_zerodiag = PETSC_TRUE;
2759 }
2760 ierr = ISDestroy(&t_zerodiag_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2760,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2761 ierr = ISLocalToGlobalMappingDestroy(&l2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2761,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2762 }
2763 }
2764 } else { /* there's just one subdomain (or zero if they have not been detected */
2765 PetscBool valid = PETSC_TRUE;
2766
2767 if (nneu) valid = PETSC_FALSE;
2768 if (valid && pressures) {
2769 ierr = ISEqual(pressures,zerodiag,&valid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2770 }
2771 if (valid && checkb) {
2772 ierr = MatMult(matis->A,work[0],matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2773 ierr = VecPointwiseMult(matis->x,work[1],matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2774 ierr = VecGetArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2774,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2775 for (j=0;j<n_interior_dofs;j++) {
2776 if (PetscAbsScalar(array[interior_dofs[j]]) > PETSC_SMALL1.e-10) {
2777 valid = PETSC_FALSE;
2778 break;
2779 }
2780 }
2781 ierr = VecRestoreArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2781,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2782 }
2783 if (valid) {
2784 benign_n = 1;
2785 ierr = PetscMalloc1(benign_n,&zerodiag_subs)PetscMallocA(1,PETSC_FALSE,2785,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(benign_n)*sizeof(**(&zerodiag_subs)),(&zerodiag_subs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2785,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2786 ierr = PetscObjectReference((PetscObject)zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2786,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2787 zerodiag_subs[0] = zerodiag;
2788 }
2789 }
2790 if (checkb) {
2791 ierr = VecDestroyVecs(2,&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2791,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2792 }
2793 }
2794 ierr = PetscFree(interior_dofs)((*PetscTrFree)((void*)(interior_dofs),2794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((interior_dofs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2795
2796 if (!benign_n) {
2797 PetscInt n;
2798
2799 ierr = ISDestroy(&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2799,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2800 recompute_zerodiag = PETSC_FALSE;
2801 ierr = MatGetLocalSize(pcbddc->local_mat,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2802 if (n) have_null = PETSC_FALSE;
2803 }
2804
2805 /* final check for null pressures */
2806 if (zerodiag && pressures) {
2807 ierr = ISEqual(pressures,zerodiag,&have_null);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2807,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2808 }
2809
2810 if (recompute_zerodiag) {
2811 ierr = ISDestroy(&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2812 if (benign_n == 1) {
2813 ierr = PetscObjectReference((PetscObject)zerodiag_subs[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2813,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2814 zerodiag = zerodiag_subs[0];
2815 } else {
2816 PetscInt i,nzn,*new_idxs;
2817
2818 nzn = 0;
2819 for (i=0;i<benign_n;i++) {
2820 PetscInt ns;
2821 ierr = ISGetLocalSize(zerodiag_subs[i],&ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2822 nzn += ns;
2823 }
2824 ierr = PetscMalloc1(nzn,&new_idxs)PetscMallocA(1,PETSC_FALSE,2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nzn)*sizeof(**(&new_idxs)),(&new_idxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2825 nzn = 0;
2826 for (i=0;i<benign_n;i++) {
2827 PetscInt ns,*idxs;
2828 ierr = ISGetLocalSize(zerodiag_subs[i],&ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2828,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2829 ierr = ISGetIndices(zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2829,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2830 ierr = PetscMemcpy(new_idxs+nzn,idxs,ns*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2830,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2831 ierr = ISRestoreIndices(zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2831,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2832 nzn += ns;
2833 }
2834 ierr = PetscSortInt(nzn,new_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2835 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),nzn,new_idxs,PETSC_OWN_POINTER,&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2836 }
2837 have_null = PETSC_FALSE;
2838 }
2839
2840 /* determines if the coarse solver will be singular or not */
2841 ierr = MPIU_Allreduce(&have_null,&pcbddc->benign_null,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,2841,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&have_null),(&
pcbddc->benign_null),(1),(MPIU_BOOL),((MPI_Op)(0x58000005)
),(PetscObjectComm((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2841,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2842
2843 /* Prepare matrix to compute no-net-flux */
2844 if (pcbddc->compute_nonetflux && !pcbddc->divudotp) {
2845 Mat A,loc_divudotp;
2846 ISLocalToGlobalMapping rl2g,cl2g,l2gmap;
2847 IS row,col,isused = NULL((void*)0);
2848 PetscInt M,N,n,st,n_isused;
2849
2850 if (pressures) {
2851 isused = pressures;
2852 } else {
2853 isused = zerodiag_save;
2854 }
2855 ierr = MatGetLocalToGlobalMapping(pc->pmat,&l2gmap,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2855,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2856 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2857 ierr = MatGetLocalSize(A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2857,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2858 if (!isused && n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Don't know how to extract div u dot p! Please provide the pressure field")return PetscError(((MPI_Comm)0x44000001),2858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Don't know how to extract div u dot p! Please provide the pressure field"
)
;
2859 n_isused = 0;
2860 if (isused) {
2861 ierr = ISGetLocalSize(isused,&n_isused);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2862 }
2863 ierr = MPI_Scan(&n_isused,&st,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),PetscObjectComm((PetscObject)pc));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2863,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2864 st = st-n_isused;
2865 if (n) {
2866 const PetscInt *gidxs;
2867
2868 ierr = MatCreateSubMatrix(A,isused,NULL((void*)0),MAT_INITIAL_MATRIX,&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2869 ierr = ISLocalToGlobalMappingGetIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2870 /* TODO: extend ISCreateStride with st = PETSC_DECIDE */
2871 ierr = ISCreateStride(PetscObjectComm((PetscObject)pc),n_isused,st,1,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2871,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2872 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),n,gidxs,PETSC_COPY_VALUES,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2872,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2873 ierr = ISLocalToGlobalMappingRestoreIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2874 } else {
2875 ierr = MatCreateSeqAIJ(PETSC_COMM_SELF((MPI_Comm)0x44000001),0,0,1,NULL((void*)0),&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2876 ierr = ISCreateStride(PetscObjectComm((PetscObject)pc),n_isused,st,1,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2876,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2877 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),0,NULL((void*)0),PETSC_COPY_VALUES,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2877,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2878 }
2879 ierr = MatGetSize(pc->pmat,NULL((void*)0),&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2879,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2880 ierr = ISGetSize(row,&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2880,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2881 ierr = ISLocalToGlobalMappingCreateIS(row,&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2881,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2882 ierr = ISLocalToGlobalMappingCreateIS(col,&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2882,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2883 ierr = ISDestroy(&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2883,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2884 ierr = ISDestroy(&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2884,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2885 ierr = MatCreate(PetscObjectComm((PetscObject)pc),&pcbddc->divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2886 ierr = MatSetType(pcbddc->divudotp,MATIS"is");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2886,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2887 ierr = MatSetSizes(pcbddc->divudotp,PETSC_DECIDE-1,PETSC_DECIDE-1,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2887,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2888 ierr = MatSetLocalToGlobalMapping(pcbddc->divudotp,rl2g,cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2888,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2889 ierr = ISLocalToGlobalMappingDestroy(&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2889,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2890 ierr = ISLocalToGlobalMappingDestroy(&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2891 ierr = MatISSetLocalMat(pcbddc->divudotp,loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2891,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2892 ierr = MatDestroy(&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2892,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2893 ierr = MatAssemblyBegin(pcbddc->divudotp,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2893,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2894 ierr = MatAssemblyEnd(pcbddc->divudotp,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2894,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2895 }
2896 ierr = ISDestroy(&zerodiag_save);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2897 ierr = ISDestroy(&pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2898 if (bzerodiag) {
2899 PetscInt i;
2900
2901 for (i=0;i<bsp;i++) {
2902 ierr = ISDestroy(&bzerodiag[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2902,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2903 }
2904 ierr = PetscFree(bzerodiag)((*PetscTrFree)((void*)(bzerodiag),2904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((bzerodiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2905 }
2906 pcbddc->benign_n = benign_n;
2907 pcbddc->benign_zerodiag_subs = zerodiag_subs;
2908
2909 /* determines if the problem has subdomains with 0 pressure block */
2910 have_null = (PetscBool)(!!pcbddc->benign_n);
2911 ierr = MPIU_Allreduce(&have_null,&pcbddc->benign_have_null,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,2911,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&have_null),(&
pcbddc->benign_have_null),(1),(MPIU_BOOL),((MPI_Op)(0x58000007
)),(PetscObjectComm((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2911,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2912
2913project_b0:
2914 ierr = MatGetLocalSize(pcbddc->local_mat,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2915 /* change of basis and p0 dofs */
2916 if (pcbddc->benign_n) {
2917 PetscInt i,s,*nnz;
2918
2919 /* local change of basis for pressures */
2920 ierr = MatDestroy(&pcbddc->benign_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2921 ierr = MatCreate(PetscObjectComm((PetscObject)pcbddc->local_mat),&pcbddc->benign_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2922 ierr = MatSetType(pcbddc->benign_change,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2922,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2923 ierr = MatSetSizes(pcbddc->benign_change,n,n,PETSC_DECIDE-1,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2923,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2924 ierr = PetscMalloc1(n,&nnz)PetscMallocA(1,PETSC_FALSE,2924,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2924,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2925 for (i=0;i<n;i++) nnz[i] = 1; /* defaults to identity */
2926 for (i=0;i<pcbddc->benign_n;i++) {
2927 const PetscInt *idxs;
2928 PetscInt nzs,j;
2929
2930 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[i],&nzs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2931 ierr = ISGetIndices(pcbddc->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2932 for (j=0;j<nzs-1;j++) nnz[idxs[j]] = 2; /* change on pressures */
2933 nnz[idxs[nzs-1]] = nzs; /* last local pressure dof in subdomain */
2934 ierr = ISRestoreIndices(pcbddc->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2935 }
2936 ierr = MatSeqAIJSetPreallocation(pcbddc->benign_change,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2937 ierr = MatSetOption(pcbddc->benign_change,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2938 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2939 /* set identity by default */
2940 for (i=0;i<n;i++) {
2941 ierr = MatSetValue(pcbddc->benign_change,i,i,1.,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2941,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2942 }
2943 ierr = PetscFree3(pcbddc->benign_p0_lidx,pcbddc->benign_p0_gidx,pcbddc->benign_p0)PetscFreeA(3,2943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->benign_p0_lidx),&(pcbddc->benign_p0_gidx
),&(pcbddc->benign_p0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2944 ierr = PetscMalloc3(pcbddc->benign_n,&pcbddc->benign_p0_lidx,pcbddc->benign_n,&pcbddc->benign_p0_gidx,pcbddc->benign_n,&pcbddc->benign_p0)PetscMallocA(3,PETSC_FALSE,2944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->benign_n)*sizeof(**(&pcbddc->benign_p0_lidx
)),(&pcbddc->benign_p0_lidx),(size_t)(pcbddc->benign_n
)*sizeof(**(&pcbddc->benign_p0_gidx)),(&pcbddc->
benign_p0_gidx),(size_t)(pcbddc->benign_n)*sizeof(**(&
pcbddc->benign_p0)),(&pcbddc->benign_p0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2945 /* set change on pressures */
2946 for (s=0;s<pcbddc->benign_n;s++) {
2947 PetscScalar *array;
2948 const PetscInt *idxs;
2949 PetscInt nzs;
2950
2951 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[s],&nzs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2951,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2952 ierr = ISGetIndices(pcbddc->benign_zerodiag_subs[s],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2952,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2953 for (i=0;i<nzs-1;i++) {
2954 PetscScalar vals[2];
2955 PetscInt cols[2];
2956
2957 cols[0] = idxs[i];
2958 cols[1] = idxs[nzs-1];
2959 vals[0] = 1.;
2960 vals[1] = 1.;
2961 ierr = MatSetValues(pcbddc->benign_change,1,cols,2,cols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2961,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2962 }
2963 ierr = PetscMalloc1(nzs,&array)PetscMallocA(1,PETSC_FALSE,2963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nzs)*sizeof(**(&array)),(&array))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2964 for (i=0;i<nzs-1;i++) array[i] = -1.;
2965 array[nzs-1] = 1.;
2966 ierr = MatSetValues(pcbddc->benign_change,1,idxs+nzs-1,nzs,idxs,array,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2966,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2967 /* store local idxs for p0 */
2968 pcbddc->benign_p0_lidx[s] = idxs[nzs-1];
2969 ierr = ISRestoreIndices(pcbddc->benign_zerodiag_subs[s],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2969,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2970 ierr = PetscFree(array)((*PetscTrFree)((void*)(array),2970,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((array) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2970,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2971 }
2972 ierr = MatAssemblyBegin(pcbddc->benign_change,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2973 ierr = MatAssemblyEnd(pcbddc->benign_change,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2974
2975 /* project if needed */
2976 if (pcbddc->benign_change_explicit) {
2977 Mat M;
2978
2979 ierr = MatPtAP(pcbddc->local_mat,pcbddc->benign_change,MAT_INITIAL_MATRIX,2.0,&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2979,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2980 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2981 ierr = MatSeqAIJCompress(M,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2982 ierr = MatDestroy(&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2982,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2983 }
2984 /* store global idxs for p0 */
2985 ierr = ISLocalToGlobalMappingApply(pc->pmat->rmap->mapping,pcbddc->benign_n,pcbddc->benign_p0_lidx,pcbddc->benign_p0_gidx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2985,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2986 }
2987 *zerodiaglocal = zerodiag;
2988 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2989}
2990
2991PetscErrorCode PCBDDCBenignGetOrSetP0(PC pc, Vec v, PetscBool get)
2992{
2993 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
2994 PetscScalar *array;
2995 PetscErrorCode ierr;
2996
2997 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2997; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2998 if (!pcbddc->benign_sf) {
2999 ierr = PetscSFCreate(PetscObjectComm((PetscObject)pc),&pcbddc->benign_sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2999,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3000 ierr = PetscSFSetGraphLayout(pcbddc->benign_sf,pc->pmat->rmap,pcbddc->benign_n,NULL((void*)0),PETSC_OWN_POINTER,pcbddc->benign_p0_gidx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3000,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3001 }
3002 if (get) {
3003 ierr = VecGetArrayRead(v,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3003,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3004 ierr = PetscSFBcastBegin(pcbddc->benign_sf,MPIU_SCALAR((MPI_Datatype)0x4c00080b),array,pcbddc->benign_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3004,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3005 ierr = PetscSFBcastEnd(pcbddc->benign_sf,MPIU_SCALAR((MPI_Datatype)0x4c00080b),array,pcbddc->benign_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3005,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3006 ierr = VecRestoreArrayRead(v,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3006,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3007 } else {
3008 ierr = VecGetArray(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3008,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3009 ierr = PetscSFReduceBegin(pcbddc->benign_sf,MPIU_SCALAR((MPI_Datatype)0x4c00080b),pcbddc->benign_p0,array,MPIU_REPLACE(MPI_Op)(0x5800000d));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3009,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3010 ierr = PetscSFReduceEnd(pcbddc->benign_sf,MPIU_SCALAR((MPI_Datatype)0x4c00080b),pcbddc->benign_p0,array,MPIU_REPLACE(MPI_Op)(0x5800000d));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3010,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3011 ierr = VecRestoreArray(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3011,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3012 }
3013 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3014}
3015
3016PetscErrorCode PCBDDCBenignPopOrPushB0(PC pc, PetscBool pop)
3017{
3018 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
3019 PetscErrorCode ierr;
3020
3021 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3021; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3022 /* TODO: add error checking
3023 - avoid nested pop (or push) calls.
3024 - cannot push before pop.
3025 - cannot call this if pcbddc->local_mat is NULL
3026 */
3027 if (!pcbddc->benign_n) {
3028 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3029 }
3030 if (pop) {
3031 if (pcbddc->benign_change_explicit) {
3032 IS is_p0;
3033 MatReuse reuse;
3034
3035 /* extract B_0 */
3036 reuse = MAT_INITIAL_MATRIX;
3037 if (pcbddc->benign_B0) {
3038 reuse = MAT_REUSE_MATRIX;
3039 }
3040 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->benign_n,pcbddc->benign_p0_lidx,PETSC_COPY_VALUES,&is_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3040,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3041 ierr = MatCreateSubMatrix(pcbddc->local_mat,is_p0,NULL((void*)0),reuse,&pcbddc->benign_B0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3041,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3042 /* remove rows and cols from local problem */
3043 ierr = MatSetOption(pcbddc->local_mat,MAT_KEEP_NONZERO_PATTERN,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3043,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3044 ierr = MatSetOption(pcbddc->local_mat,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3045 ierr = MatZeroRowsColumnsIS(pcbddc->local_mat,is_p0,1.0,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3045,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3046 ierr = ISDestroy(&is_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3046,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3047 } else {
3048 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
3049 PetscScalar *vals;
3050 PetscInt i,n,*idxs_ins;
3051
3052 ierr = VecGetLocalSize(matis->y,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3052,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3053 ierr = PetscMalloc2(n,&idxs_ins,n,&vals)PetscMallocA(2,PETSC_FALSE,3053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&idxs_ins)),(&idxs_ins),(size_t
)(n)*sizeof(**(&vals)),(&vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3054 if (!pcbddc->benign_B0) {
3055 PetscInt *nnz;
3056 ierr = MatCreate(PetscObjectComm((PetscObject)pcbddc->local_mat),&pcbddc->benign_B0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3057 ierr = MatSetType(pcbddc->benign_B0,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3057,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3058 ierr = MatSetSizes(pcbddc->benign_B0,pcbddc->benign_n,n,PETSC_DECIDE-1,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3059 ierr = PetscMalloc1(pcbddc->benign_n,&nnz)PetscMallocA(1,PETSC_FALSE,3059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->benign_n)*sizeof(**(&nnz)),(&nnz
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3060 for (i=0;i<pcbddc->benign_n;i++) {
3061 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[i],&nnz[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3061,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3062 nnz[i] = n - nnz[i];
3063 }
3064 ierr = MatSeqAIJSetPreallocation(pcbddc->benign_B0,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3065 ierr = MatSetOption(pcbddc->benign_B0,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3066 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),3066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3067 }
3068
3069 for (i=0;i<pcbddc->benign_n;i++) {
3070 PetscScalar *array;
3071 PetscInt *idxs,j,nz,cum;
3072
3073 ierr = VecSet(matis->x,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3073,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3074 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3074,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3075 ierr = ISGetIndices(pcbddc->benign_zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3076 for (j=0;j<nz;j++) vals[j] = 1.;
3077 ierr = VecSetValues(matis->x,nz,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3078 ierr = VecAssemblyBegin(matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3079 ierr = VecAssemblyEnd(matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3079,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3080 ierr = VecSet(matis->y,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3081 ierr = MatMult(matis->A,matis->x,matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3081,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3082 ierr = VecGetArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3082,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3083 cum = 0;
3084 for (j=0;j<n;j++) {
3085 if (PetscUnlikely(PetscAbsScalar(array[j]) > PETSC_SMALL)__builtin_expect(!!(PetscAbsScalar(array[j]) > 1.e-10),0)) {
3086 vals[cum] = array[j];
3087 idxs_ins[cum] = j;
3088 cum++;
3089 }
3090 }
3091 ierr = MatSetValues(pcbddc->benign_B0,1,&i,cum,idxs_ins,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3091,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3092 ierr = VecRestoreArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3092,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3093 ierr = ISRestoreIndices(pcbddc->benign_zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3094 }
3095 ierr = MatAssemblyBegin(pcbddc->benign_B0,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3095,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3096 ierr = MatAssemblyEnd(pcbddc->benign_B0,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3096,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3097 ierr = PetscFree2(idxs_ins,vals)PetscFreeA(2,3097,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(idxs_ins),&(vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3097,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3098 }
3099 } else { /* push */
3100 if (pcbddc->benign_change_explicit) {
3101 PetscInt i;
3102
3103 for (i=0;i<pcbddc->benign_n;i++) {
3104 PetscScalar *B0_vals;
3105 PetscInt *B0_cols,B0_ncol;
3106
3107 ierr = MatGetRow(pcbddc->benign_B0,i,&B0_ncol,(const PetscInt**)&B0_cols,(const PetscScalar**)&B0_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3107,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3108 ierr = MatSetValues(pcbddc->local_mat,1,pcbddc->benign_p0_lidx+i,B0_ncol,B0_cols,B0_vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3109 ierr = MatSetValues(pcbddc->local_mat,B0_ncol,B0_cols,1,pcbddc->benign_p0_lidx+i,B0_vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3109,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3110 ierr = MatSetValue(pcbddc->local_mat,pcbddc->benign_p0_lidx[i],pcbddc->benign_p0_lidx[i],0.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3110,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3111 ierr = MatRestoreRow(pcbddc->benign_B0,i,&B0_ncol,(const PetscInt**)&B0_cols,(const PetscScalar**)&B0_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3111,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3112 }
3113 ierr = MatAssemblyBegin(pcbddc->local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3114 ierr = MatAssemblyEnd(pcbddc->local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3115 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Cannot push B0!")return PetscError(((MPI_Comm)0x44000001),3115,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Cannot push B0!")
;
3116 }
3117 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3118}
3119
3120PetscErrorCode PCBDDCAdaptiveSelection(PC pc)
3121{
3122 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
3123 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
3124 PetscBLASInt B_dummyint,B_neigs,B_ierr,B_lwork;
3125 PetscBLASInt *B_iwork,*B_ifail;
3126 PetscScalar *work,lwork;
3127 PetscScalar *St,*S,*eigv;
3128 PetscScalar *Sarray,*Starray;
3129 PetscReal *eigs,thresh,lthresh,uthresh;
3130 PetscInt i,nmax,nmin,nv,cum,mss,cum2,cumarray,maxneigs;
3131 PetscBool allocated_S_St;
3132#if defined(PETSC_USE_COMPLEX)
3133 PetscReal *rwork;
3134#endif
3135 PetscErrorCode ierr;
3136
3137 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3137; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3138 if (!sub_schurs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Adaptive selection of constraints requires SubSchurs data")return PetscError(((MPI_Comm)0x44000001),3138,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Adaptive selection of constraints requires SubSchurs data"
)
;
3139 if (!sub_schurs->schur_explicit) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_SUP,"Adaptive selection of constraints requires MUMPS and/or MKL_CPARDISO")return PetscError(PetscObjectComm((PetscObject)pc),3139,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Adaptive selection of constraints requires MUMPS and/or MKL_CPARDISO"
)
;
3140 if (sub_schurs->n_subs && (!sub_schurs->is_symmetric)) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_SUP,"Adaptive selection not yet implemented for this matrix pencil (herm %d, symm %d, posdef %d)",sub_schurs->is_hermitian,sub_schurs->is_symmetric,sub_schurs->is_posdef)return PetscError(((MPI_Comm)0x44000001),3140,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Adaptive selection not yet implemented for this matrix pencil (herm %d, symm %d, posdef %d)"
,sub_schurs->is_hermitian,sub_schurs->is_symmetric,sub_schurs
->is_posdef)
;
3141 ierr = PetscLogEventBegin(PC_BDDC_AdaptiveSetUp[pcbddc->current_level],pc,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_AdaptiveSetUp[pcbddc->current_level]].active) ? (
*PetscLogPLB)((PC_BDDC_AdaptiveSetUp[pcbddc->current_level
]),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3141,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3142
3143 if (pcbddc->dbg_flag) {
3144 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3144,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3145 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3146 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Check adaptive selection of constraints\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3146,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3147 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3147,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3148 }
3149
3150 if (pcbddc->dbg_flag) {
3151 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d cc %D (%d,%d).\n",PetscGlobalRank,sub_schurs->n_subs,sub_schurs->is_hermitian,sub_schurs->is_posdef);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3151,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3152 }
3153
3154 /* max size of subsets */
3155 mss = 0;
3156 for (i=0;i<sub_schurs->n_subs;i++) {
3157 PetscInt subset_size;
3158
3159 ierr = ISGetLocalSize(sub_schurs->is_subs[i],&subset_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3159,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3160 mss = PetscMax(mss,subset_size)(((mss)<(subset_size)) ? (subset_size) : (mss));
3161 }
3162
3163 /* min/max and threshold */
3164 nmax = pcbddc->adaptive_nmax > 0 ? pcbddc->adaptive_nmax : mss;
3165 nmin = pcbddc->adaptive_nmin > 0 ? pcbddc->adaptive_nmin : 0;
3166 nmax = PetscMax(nmin,nmax)(((nmin)<(nmax)) ? (nmax) : (nmin));
3167 allocated_S_St = PETSC_FALSE;
3168 if (nmin || !sub_schurs->is_posdef) { /* XXX */
3169 allocated_S_St = PETSC_TRUE;
3170 }
3171
3172 /* allocate lapack workspace */
3173 cum = cum2 = 0;
3174 maxneigs = 0;
3175 for (i=0;i<sub_schurs->n_subs;i++) {
3176 PetscInt n,subset_size;
3177
3178 ierr = ISGetLocalSize(sub_schurs->is_subs[i],&subset_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3178,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3179 n = PetscMin(subset_size,nmax)(((subset_size)<(nmax)) ? (subset_size) : (nmax));
3180 cum += subset_size;
3181 cum2 += subset_size*n;
3182 maxneigs = PetscMax(maxneigs,n)(((maxneigs)<(n)) ? (n) : (maxneigs));
3183 }
3184 if (mss) {
3185 if (sub_schurs->is_symmetric) {
3186 PetscBLASInt B_itype = 1;
3187 PetscBLASInt B_N = mss;
3188 PetscReal zero = 0.0;
3189 PetscReal eps = 0.0; /* dlamch? */
3190
3191 B_lwork = -1;
3192 S = NULL((void*)0);
3193 St = NULL((void*)0);
3194 eigs = NULL((void*)0);
3195 eigv = NULL((void*)0);
3196 B_iwork = NULL((void*)0);
3197 B_ifail = NULL((void*)0);
3198#if defined(PETSC_USE_COMPLEX)
3199 rwork = NULL((void*)0);
3200#endif
3201 thresh = 1.0;
3202 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3203#if defined(PETSC_USE_COMPLEX)
3204 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&zero,&thresh,&B_dummyint,&B_dummyint,&eps,&B_neigs,eigs,eigv,&B_N,&lwork,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3204; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&zero,&thresh,&B_dummyint,&B_dummyint,&
eps,&B_neigs,eigs,eigv,&B_N,&lwork,&B_lwork,rwork
,B_iwork,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3205#else
3206 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&zero,&thresh,&B_dummyint,&B_dummyint,&eps,&B_neigs,eigs,eigv,&B_N,&lwork,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3206; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&zero,&thresh,&B_dummyint,&B_dummyint,&
eps,&B_neigs,eigs,eigv,&B_N,&lwork,&B_lwork,B_iwork
,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3207#endif
3208 if (B_ierr != 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to SYGVX Lapack routine %d",(int)B_ierr)return PetscError(((MPI_Comm)0x44000001),3208,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to SYGVX Lapack routine %d"
,(int)B_ierr)
;
3209 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3209,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3210 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented")return PetscError(((MPI_Comm)0x44000001),3210,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
3211 } else {
3212 lwork = 0;
3213 }
3214
3215 nv = 0;
3216 if (sub_schurs->is_vertices && pcbddc->use_vertices) { /* complement set of active subsets, each entry is a vertex (boundary made by active subsets, vertices and dirichlet dofs) */
3217 ierr = ISGetLocalSize(sub_schurs->is_vertices,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3218 }
3219 ierr = PetscBLASIntCast((PetscInt)PetscRealPart(lwork)(lwork),&B_lwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3220 if (allocated_S_St) {
3221 ierr = PetscMalloc2(mss*mss,&S,mss*mss,&St)PetscMallocA(2,PETSC_FALSE,3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(mss*mss)*sizeof(**(&S)),(&S),(size_t)(mss*mss
)*sizeof(**(&St)),(&St))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3222 }
3223 ierr = PetscMalloc5(mss*mss,&eigv,mss,&eigs,B_lwork,&work,5*mss,&B_iwork,mss,&B_ifail)PetscMallocA(5,PETSC_FALSE,3223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(mss*mss)*sizeof(**(&eigv)),(&eigv),(size_t)
(mss)*sizeof(**(&eigs)),(&eigs),(size_t)(B_lwork)*sizeof
(**(&work)),(&work),(size_t)(5*mss)*sizeof(**(&B_iwork
)),(&B_iwork),(size_t)(mss)*sizeof(**(&B_ifail)),(&
B_ifail))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3224#if defined(PETSC_USE_COMPLEX)
3225 ierr = PetscMalloc1(7*mss,&rwork)PetscMallocA(1,PETSC_FALSE,3225,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(7*mss)*sizeof(**(&rwork)),(&rwork))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3225,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3226#endif
3227 ierr = PetscMalloc5(nv+sub_schurs->n_subs,&pcbddc->adaptive_constraints_n,PetscMallocA(5,PETSC_FALSE,3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nv+sub_schurs->n_subs)*sizeof(**(&pcbddc->
adaptive_constraints_n)),(&pcbddc->adaptive_constraints_n
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_idxs_ptr)),(&pcbddc->adaptive_constraints_idxs_ptr
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_data_ptr)),(&pcbddc->adaptive_constraints_data_ptr
),(size_t)(nv+cum)*sizeof(**(&pcbddc->adaptive_constraints_idxs
)),(&pcbddc->adaptive_constraints_idxs),(size_t)(nv+cum2
)*sizeof(**(&pcbddc->adaptive_constraints_data)),(&
pcbddc->adaptive_constraints_data))
3228 nv+sub_schurs->n_subs+1,&pcbddc->adaptive_constraints_idxs_ptr,PetscMallocA(5,PETSC_FALSE,3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nv+sub_schurs->n_subs)*sizeof(**(&pcbddc->
adaptive_constraints_n)),(&pcbddc->adaptive_constraints_n
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_idxs_ptr)),(&pcbddc->adaptive_constraints_idxs_ptr
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_data_ptr)),(&pcbddc->adaptive_constraints_data_ptr
),(size_t)(nv+cum)*sizeof(**(&pcbddc->adaptive_constraints_idxs
)),(&pcbddc->adaptive_constraints_idxs),(size_t)(nv+cum2
)*sizeof(**(&pcbddc->adaptive_constraints_data)),(&
pcbddc->adaptive_constraints_data))
3229 nv+sub_schurs->n_subs+1,&pcbddc->adaptive_constraints_data_ptr,PetscMallocA(5,PETSC_FALSE,3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nv+sub_schurs->n_subs)*sizeof(**(&pcbddc->
adaptive_constraints_n)),(&pcbddc->adaptive_constraints_n
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_idxs_ptr)),(&pcbddc->adaptive_constraints_idxs_ptr
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_data_ptr)),(&pcbddc->adaptive_constraints_data_ptr
),(size_t)(nv+cum)*sizeof(**(&pcbddc->adaptive_constraints_idxs
)),(&pcbddc->adaptive_constraints_idxs),(size_t)(nv+cum2
)*sizeof(**(&pcbddc->adaptive_constraints_data)),(&
pcbddc->adaptive_constraints_data))
3230 nv+cum,&pcbddc->adaptive_constraints_idxs,PetscMallocA(5,PETSC_FALSE,3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nv+sub_schurs->n_subs)*sizeof(**(&pcbddc->
adaptive_constraints_n)),(&pcbddc->adaptive_constraints_n
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_idxs_ptr)),(&pcbddc->adaptive_constraints_idxs_ptr
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_data_ptr)),(&pcbddc->adaptive_constraints_data_ptr
),(size_t)(nv+cum)*sizeof(**(&pcbddc->adaptive_constraints_idxs
)),(&pcbddc->adaptive_constraints_idxs),(size_t)(nv+cum2
)*sizeof(**(&pcbddc->adaptive_constraints_data)),(&
pcbddc->adaptive_constraints_data))
3231 nv+cum2,&pcbddc->adaptive_constraints_data)PetscMallocA(5,PETSC_FALSE,3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nv+sub_schurs->n_subs)*sizeof(**(&pcbddc->
adaptive_constraints_n)),(&pcbddc->adaptive_constraints_n
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_idxs_ptr)),(&pcbddc->adaptive_constraints_idxs_ptr
),(size_t)(nv+sub_schurs->n_subs+1)*sizeof(**(&pcbddc->
adaptive_constraints_data_ptr)),(&pcbddc->adaptive_constraints_data_ptr
),(size_t)(nv+cum)*sizeof(**(&pcbddc->adaptive_constraints_idxs
)),(&pcbddc->adaptive_constraints_idxs),(size_t)(nv+cum2
)*sizeof(**(&pcbddc->adaptive_constraints_data)),(&
pcbddc->adaptive_constraints_data))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3232 ierr = PetscMemzero(pcbddc->adaptive_constraints_n,(nv+sub_schurs->n_subs)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3232,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3233
3234 maxneigs = 0;
3235 cum = cumarray = 0;
3236 pcbddc->adaptive_constraints_idxs_ptr[0] = 0;
3237 pcbddc->adaptive_constraints_data_ptr[0] = 0;
3238 if (sub_schurs->is_vertices && pcbddc->use_vertices) {
3239 const PetscInt *idxs;
3240
3241 ierr = ISGetIndices(sub_schurs->is_vertices,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3241,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3242 for (cum=0;cum<nv;cum++) {
3243 pcbddc->adaptive_constraints_n[cum] = 1;
3244 pcbddc->adaptive_constraints_idxs[cum] = idxs[cum];
3245 pcbddc->adaptive_constraints_data[cum] = 1.0;
3246 pcbddc->adaptive_constraints_idxs_ptr[cum+1] = pcbddc->adaptive_constraints_idxs_ptr[cum]+1;
3247 pcbddc->adaptive_constraints_data_ptr[cum+1] = pcbddc->adaptive_constraints_data_ptr[cum]+1;
3248 }
3249 ierr = ISRestoreIndices(sub_schurs->is_vertices,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3250 }
3251
3252 if (mss) { /* multilevel */
3253 ierr = MatSeqAIJGetArray(sub_schurs->sum_S_Ej_inv_all,&Sarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3254 ierr = MatSeqAIJGetArray(sub_schurs->sum_S_Ej_tilda_all,&Starray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3254,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3255 }
3256
3257 lthresh = pcbddc->adaptive_threshold[0];
3258 uthresh = pcbddc->adaptive_threshold[1];
3259 for (i=0;i<sub_schurs->n_subs;i++) {
3260 const PetscInt *idxs;
3261 PetscReal upper,lower;
3262 PetscInt j,subset_size,eigs_start = 0;
3263 PetscBLASInt B_N;
3264 PetscBool same_data = PETSC_FALSE;
3265 PetscBool scal = PETSC_FALSE;
3266
3267 if (pcbddc->use_deluxe_scaling) {
3268 upper = PETSC_MAX_REAL1.7976931348623157e+308;
3269 lower = uthresh;
3270 } else {
3271 if (!sub_schurs->is_posdef) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented without deluxe scaling")return PetscError(((MPI_Comm)0x44000001),3271,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented without deluxe scaling"
)
;
3272 upper = 1./uthresh;
3273 lower = 0.;
3274 }
3275 ierr = ISGetLocalSize(sub_schurs->is_subs[i],&subset_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3275,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3276 ierr = ISGetIndices(sub_schurs->is_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3276,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3277 ierr = PetscBLASIntCast(subset_size,&B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3278 /* this is experimental: we assume the dofs have been properly grouped to have
3279 the diagonal blocks Schur complements either positive or negative definite (true for Stokes) */
3280 if (!sub_schurs->is_posdef) {
3281 Mat T;
3282
3283 for (j=0;j<subset_size;j++) {
3284 if (PetscRealPart(*(Sarray+cumarray+j*(subset_size+1)))(*(Sarray+cumarray+j*(subset_size+1))) < 0.0) {
3285 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),subset_size,subset_size,Sarray+cumarray,&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3285,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3286 ierr = MatScale(T,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3287 ierr = MatDestroy(&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3288 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),subset_size,subset_size,Starray+cumarray,&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3289 ierr = MatScale(T,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3289,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3290 ierr = MatDestroy(&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3291 if (sub_schurs->change_primal_sub) {
3292 PetscInt nz,k;
3293 const PetscInt *idxs;
3294
3295 ierr = ISGetLocalSize(sub_schurs->change_primal_sub[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3296 ierr = ISGetIndices(sub_schurs->change_primal_sub[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3297 for (k=0;k<nz;k++) {
3298 *( Sarray + cumarray + idxs[k]*(subset_size+1)) *= -1.0;
3299 *(Starray + cumarray + idxs[k]*(subset_size+1)) = 0.0;
3300 }
3301 ierr = ISRestoreIndices(sub_schurs->change_primal_sub[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3302 }
3303 scal = PETSC_TRUE;
3304 break;
3305 }
3306 }
3307 }
3308
3309 if (allocated_S_St) { /* S and S_t should be copied since we could need them later */
3310 if (sub_schurs->is_symmetric) {
3311 PetscInt j,k;
3312 if (sub_schurs->n_subs == 1) { /* zeroing memory to use PetscMemcmp later */
3313 ierr = PetscMemzero(S,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3313,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3314 ierr = PetscMemzero(St,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3314,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3315 }
3316 for (j=0;j<subset_size;j++) {
3317 for (k=j;k<subset_size;k++) {
3318 S [j*subset_size+k] = Sarray [cumarray+j*subset_size+k];
3319 St[j*subset_size+k] = Starray[cumarray+j*subset_size+k];
3320 }
3321 }
3322 } else {
3323 ierr = PetscMemcpy(S,Sarray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3323,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3324 ierr = PetscMemcpy(St,Starray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3324,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3325 }
3326 } else {
3327 S = Sarray + cumarray;
3328 St = Starray + cumarray;
3329 }
3330 /* see if we can save some work */
3331 if (sub_schurs->n_subs == 1 && pcbddc->use_deluxe_scaling) {
3332 ierr = PetscMemcmp(S,St,subset_size*subset_size*sizeof(PetscScalar),&same_data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3332,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3333 }
3334
3335 if (same_data && !sub_schurs->change) { /* there's no need of constraints here */
3336 B_neigs = 0;
3337 } else {
3338 if (sub_schurs->is_symmetric) {
3339 PetscBLASInt B_itype = 1;
3340 PetscBLASInt B_IL, B_IU;
3341 PetscReal eps = -1.0; /* dlamch? */
3342 PetscInt nmin_s;
3343 PetscBool compute_range;
3344
3345 B_neigs = 0;
3346 compute_range = (PetscBool)!same_data;
3347 if (nmin >= subset_size) compute_range = PETSC_FALSE;
3348
3349 if (pcbddc->dbg_flag) {
3350 PetscInt nc = 0;
3351
3352 if (sub_schurs->change_primal_sub) {
3353 ierr = ISGetLocalSize(sub_schurs->change_primal_sub[i],&nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3353,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3354 }
3355 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Computing for sub %D/%D size %D count %D fid %D (range %d) (change %D).\n",i,sub_schurs->n_subs,subset_size,pcbddc->mat_graph->count[idxs[0]]+1,pcbddc->mat_graph->which_dof[idxs[0]],compute_range,nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3356 }
3357
3358 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3358,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3359 if (compute_range) {
3360
3361 /* ask for eigenvalues larger than thresh */
3362 if (sub_schurs->is_posdef) {
3363#if defined(PETSC_USE_COMPLEX)
3364 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3364; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3365#else
3366 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3366; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3366
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3366,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3367#endif
3368 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3368,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3369 } else { /* no theory so far, but it works nicely */
3370 PetscInt recipe = 0,recipe_m = 1;
3371 PetscReal bb[2];
3372
3373 ierr = PetscOptionsGetInt(NULL((void*)0),((PetscObject)pc)->prefix,"-pc_bddc_adaptive_recipe",&recipe,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3374 switch (recipe) {
3375 case 0:
3376 if (scal) { bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308); bb[1] = lthresh; }
3377 else { bb[0] = uthresh; bb[1] = PETSC_MAX_REAL1.7976931348623157e+308; }
3378#if defined(PETSC_USE_COMPLEX)
3379 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3379; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3379,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3379,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3380#else
3381 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3381; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3381
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3382#endif
3383 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3384 break;
3385 case 1:
3386 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308); bb[1] = lthresh*lthresh;
3387#if defined(PETSC_USE_COMPLEX)
3388 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3388; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3389#else
3390 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3390; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3390
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3391#endif
3392 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3393 if (!scal) {
3394 PetscBLASInt B_neigs2 = 0;
3395
3396 bb[0] = PetscMax(lthresh*lthresh,uthresh)(((lthresh*lthresh)<(uthresh)) ? (uthresh) : (lthresh*lthresh
))
; bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3397 ierr = PetscMemcpy(S,Sarray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3397,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3398 ierr = PetscMemcpy(St,Starray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3398,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3399#if defined(PETSC_USE_COMPLEX)
3400 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3400; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork
,B_iwork,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(3400,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3400,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3401#else
3402 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3402; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork
,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3402,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3402,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3403#endif
3404 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3405 B_neigs += B_neigs2;
3406 }
3407 break;
3408 case 2:
3409 if (scal) {
3410 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308);
3411 bb[1] = 0;
3412#if defined(PETSC_USE_COMPLEX)
3413 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3413; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3413,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3413,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3414#else
3415 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3415; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3415
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3416#endif
3417 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3418 } else {
3419 PetscBLASInt B_neigs2 = 0;
3420 PetscBool import = PETSC_FALSE;
3421
3422 lthresh = PetscMax(lthresh,0.0)(((lthresh)<(0.0)) ? (0.0) : (lthresh));
3423 if (lthresh > 0.0) {
3424 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308);
3425 bb[1] = lthresh*lthresh;
3426
3427 import = PETSC_TRUE;
3428#if defined(PETSC_USE_COMPLEX)
3429 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3429; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3430#else
3431 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3431; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3431
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3432#endif
3433 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3434 }
3435 bb[0] = PetscMax(lthresh*lthresh,uthresh)(((lthresh*lthresh)<(uthresh)) ? (uthresh) : (lthresh*lthresh
))
;
3436 bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3437 if (import) {
3438 ierr = PetscMemcpy(S,Sarray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3438,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3439 ierr = PetscMemcpy(St,Starray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3439,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3440 }
3441#if defined(PETSC_USE_COMPLEX)
3442 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3442; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork
,B_iwork,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(3442,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3442,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3443#else
3444 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3444; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork
,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3444,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3444,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3445#endif
3446 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3446,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3447 B_neigs += B_neigs2;
3448 }
3449 break;
3450 case 3:
3451 if (scal) {
3452 ierr = PetscOptionsGetInt(NULL((void*)0),((PetscObject)pc)->prefix,"-pc_bddc_adaptive_recipe3_min_scal",&recipe_m,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3452,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3453 } else {
3454 ierr = PetscOptionsGetInt(NULL((void*)0),((PetscObject)pc)->prefix,"-pc_bddc_adaptive_recipe3_min",&recipe_m,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3454,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3455 }
3456 if (!scal) {
3457 bb[0] = uthresh;
3458 bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3459#if defined(PETSC_USE_COMPLEX)
3460 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3460; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3460,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3460,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3461#else
3462 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3462; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3462
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3462,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3463#endif
3464 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3465 }
3466 if (recipe_m > 0 && B_N - B_neigs > 0) {
3467 PetscBLASInt B_neigs2 = 0;
3468
3469 B_IL = 1;
3470 ierr = PetscBLASIntCast(PetscMin(recipe_m,B_N - B_neigs)(((recipe_m)<(B_N - B_neigs)) ? (recipe_m) : (B_N - B_neigs
))
,&B_IU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3470,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3471 ierr = PetscMemcpy(S,Sarray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3471,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3472 ierr = PetscMemcpy(St,Starray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3472,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3473#if defined(PETSC_USE_COMPLEX)
3474 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3474; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork
,B_iwork,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(3474,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3474,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3475#else
3476 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3476; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork
,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3476,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3476,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3477#endif
3478 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3478,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3479 B_neigs += B_neigs2;
3480 }
3481 break;
3482 case 4:
3483 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308); bb[1] = lthresh;
3484#if defined(PETSC_USE_COMPLEX)
3485 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3485; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3486#else
3487 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3487; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3487
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3488#endif
3489 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3490 {
3491 PetscBLASInt B_neigs2 = 0;
3492
3493 bb[0] = PetscMax(lthresh+PETSC_SMALL,uthresh)(((lthresh+1.e-10)<(uthresh)) ? (uthresh) : (lthresh+1.e-10
))
; bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3494 ierr = PetscMemcpy(S,Sarray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3495 ierr = PetscMemcpy(St,Starray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3496#if defined(PETSC_USE_COMPLEX)
3497 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3497; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,rwork
,B_iwork,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(3497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3498#else
3499 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3499; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","V","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*B_N,&B_N,work,&B_lwork,B_iwork
,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3499,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3499,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3500#endif
3501 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3501,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3502 B_neigs += B_neigs2;
3503 }
3504 break;
3505 case 5: /* same as before: first compute all eigenvalues, then filter */
3506#if defined(PETSC_USE_COMPLEX)
3507 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","A","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3507; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","A","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3507,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3507,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3508#else
3509 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","A","L",&B_N,St,&B_N,S,&B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3509; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","A","L",&B_N,St,&B_N,S,&
B_N,&bb[0],&bb[1],&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3509
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3510#endif
3511 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3512 {
3513 PetscInt e,k,ne;
3514 for (e=0,ne=0;e<B_neigs;e++) {
3515 if (eigs[e] < lthresh || eigs[e] > uthresh) {
3516 for (k=0;k<B_N;k++) S[ne*B_N+k] = eigv[e*B_N+k];
3517 eigs[ne] = eigs[e];
3518 ne++;
3519 }
3520 }
3521 ierr = PetscMemcpy(eigv,S,B_N*ne*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3522 B_neigs = ne;
3523 }
3524 break;
3525 default:
3526 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_SUP,"Unknown recipe %D",recipe)return PetscError(PetscObjectComm((PetscObject)pc),3526,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Unknown recipe %D",recipe)
;
3527 break;
3528 }
3529 }
3530 } else if (!same_data) { /* this is just to see all the eigenvalues */
3531 B_IU = PetscMax(1,PetscMin(B_N,nmax))(((1)<((((B_N)<(nmax)) ? (B_N) : (nmax)))) ? ((((B_N)<
(nmax)) ? (B_N) : (nmax))) : (1))
;
3532 B_IL = 1;
3533#if defined(PETSC_USE_COMPLEX)
3534 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3534; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&
B_ierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(3534,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3534,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3535#else
3536 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3536; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs
,eigs,eigv,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr
); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(3536
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3537#endif
3538 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3538,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3539 } else { /* same_data is true, so just get the adaptive functional requested by the user */
3540 PetscInt k;
3541 if (!sub_schurs->change_primal_sub) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"This should not happen")return PetscError(((MPI_Comm)0x44000001),3541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
3542 ierr = ISGetLocalSize(sub_schurs->change_primal_sub[i],&nmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3542,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3543 ierr = PetscBLASIntCast(nmax,&B_neigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3543,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3544 nmin = nmax;
3545 ierr = PetscMemzero(eigv,subset_size*nmax*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3545,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3546 for (k=0;k<nmax;k++) {
3547 eigs[k] = 1./PETSC_SMALL1.e-10;
3548 eigv[k*(subset_size+1)] = 1.0;
3549 }
3550 }
3551 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3552 if (B_ierr) {
3553 if (B_ierr < 0 ) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYGVX Lapack routine: illegal value for argument %d",-(int)B_ierr)return PetscError(((MPI_Comm)0x44000001),3553,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: illegal value for argument %d"
,-(int)B_ierr)
;
3554 else if (B_ierr <= B_N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYGVX Lapack routine: %d eigenvalues failed to converge",(int)B_ierr)return PetscError(((MPI_Comm)0x44000001),3554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: %d eigenvalues failed to converge"
,(int)B_ierr)
;
3555 else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYGVX Lapack routine: leading minor of order %d is not positive definite",(int)B_ierr-B_N-1)return PetscError(((MPI_Comm)0x44000001),3555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: leading minor of order %d is not positive definite"
,(int)B_ierr-B_N-1)
;
3556 }
3557
3558 if (B_neigs > nmax) {
3559 if (pcbddc->dbg_flag) {
3560 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," found %d eigs, more than maximum required %D.\n",B_neigs,nmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3561 }
3562 if (pcbddc->use_deluxe_scaling) eigs_start = scal ? 0 : B_neigs-nmax;
3563 B_neigs = nmax;
3564 }
3565
3566 nmin_s = PetscMin(nmin,B_N)(((nmin)<(B_N)) ? (nmin) : (B_N));
3567 if (B_neigs < nmin_s) {
3568 PetscBLASInt B_neigs2 = 0;
3569
3570 if (pcbddc->use_deluxe_scaling) {
3571 if (scal) {
3572 B_IU = nmin_s;
3573 B_IL = B_neigs + 1;
3574 } else {
3575 B_IL = B_N - nmin_s + 1;
3576 B_IU = B_N - B_neigs;
3577 }
3578 } else {
3579 B_IL = B_neigs + 1;
3580 B_IU = nmin_s;
3581 }
3582 if (pcbddc->dbg_flag) {
3583 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," found %d eigs, less than minimum required %D. Asking for %d to %d incl (fortran like)\n",B_neigs,nmin,B_IL,B_IU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3584 }
3585 if (sub_schurs->is_symmetric) {
3586 PetscInt j,k;
3587 for (j=0;j<subset_size;j++) {
3588 for (k=j;k<subset_size;k++) {
3589 S [j*subset_size+k] = Sarray [cumarray+j*subset_size+k];
3590 St[j*subset_size+k] = Starray[cumarray+j*subset_size+k];
3591 }
3592 }
3593 } else {
3594 ierr = PetscMemcpy(S,Sarray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3594,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3595 ierr = PetscMemcpy(St,Starray+cumarray,subset_size*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3595,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3596 }
3597 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3597,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3598#if defined(PETSC_USE_COMPLEX)
3599 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*subset_size,&B_N,work,&B_lwork,rwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3599; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*subset_size,&B_N,work,&B_lwork
,rwork,B_iwork,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(3599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3600#else
3601 PetscStackCallBLAS("LAPACKsygvx",LAPACKsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2,eigs+B_neigs,eigv+B_neigs*subset_size,&B_N,work,&B_lwork,B_iwork,B_ifail,&B_ierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsygvx"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3601; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsygvx_(&B_itype,"V","I","L",&B_N,St,&B_N,S,&
B_N,&lower,&upper,&B_IL,&B_IU,&eps,&B_neigs2
,eigs+B_neigs,eigv+B_neigs*subset_size,&B_N,work,&B_lwork
,B_iwork,B_ifail,&B_ierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(3601,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3601,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
3602#endif
3603 ierr = PetscLogFlops((4.0*subset_size*subset_size*subset_size)/3.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3603,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3604 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3604,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3605 B_neigs += B_neigs2;
3606 }
3607 if (B_ierr) {
3608 if (B_ierr < 0 ) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYGVX Lapack routine: illegal value for argument %d",-(int)B_ierr)return PetscError(((MPI_Comm)0x44000001),3608,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: illegal value for argument %d"
,-(int)B_ierr)
;
3609 else if (B_ierr <= B_N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYGVX Lapack routine: %d eigenvalues failed to converge",(int)B_ierr)return PetscError(((MPI_Comm)0x44000001),3609,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: %d eigenvalues failed to converge"
,(int)B_ierr)
;
3610 else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYGVX Lapack routine: leading minor of order %d is not positive definite",(int)B_ierr-B_N-1)return PetscError(((MPI_Comm)0x44000001),3610,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: leading minor of order %d is not positive definite"
,(int)B_ierr-B_N-1)
;
3611 }
3612 if (pcbddc->dbg_flag) {
3613 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," -> Got %d eigs\n",B_neigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3613,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3614 for (j=0;j<B_neigs;j++) {
3615 if (eigs[j] == 0.0) {
3616 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," Inf\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3616,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3617 } else {
3618 if (pcbddc->use_deluxe_scaling) {
3619 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," %1.6e\n",eigs[j+eigs_start]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3619,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3620 } else {
3621 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," %1.6e\n",1./eigs[j+eigs_start]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3621,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3622 }
3623 }
3624 }
3625 }
3626 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented")return PetscError(((MPI_Comm)0x44000001),3626,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
3627 }
3628 /* change the basis back to the original one */
3629 if (sub_schurs->change) {
3630 Mat change,phi,phit;
3631
3632 if (pcbddc->dbg_flag > 2) {
3633 PetscInt ii;
3634 for (ii=0;ii<B_neigs;ii++) {
3635 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," -> Eigenvector (old basis) %d/%d (%d)\n",ii,B_neigs,B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3636 for (j=0;j<B_N;j++) {
3637#if defined(PETSC_USE_COMPLEX)
3638 PetscReal r = PetscRealPart(eigv[(ii+eigs_start)*subset_size+j])(eigv[(ii+eigs_start)*subset_size+j]);
3639 PetscReal c = PetscImaginaryPart(eigv[(ii+eigs_start)*subset_size+j])((PetscReal)0.);
3640 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," %1.4e + %1.4e i\n",r,c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3640,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3641#else
3642 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," %1.4e\n",eigv[(ii+eigs_start)*subset_size+j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3642,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3643#endif
3644 }
3645 }
3646 }
3647 ierr = KSPGetOperators(sub_schurs->change[i],&change,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3648 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),subset_size,B_neigs,eigv+eigs_start*subset_size,&phit);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3648,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3649 ierr = MatMatMult(change,phit,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&phi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3650 ierr = MatCopy(phi,phit,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3651 ierr = MatDestroy(&phit);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3652 ierr = MatDestroy(&phi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3652,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3653 }
3654 maxneigs = PetscMax(B_neigs,maxneigs)(((B_neigs)<(maxneigs)) ? (maxneigs) : (B_neigs));
3655 pcbddc->adaptive_constraints_n[i+nv] = B_neigs;
3656 if (B_neigs) {
3657 ierr = PetscMemcpy(pcbddc->adaptive_constraints_data+pcbddc->adaptive_constraints_data_ptr[cum],eigv+eigs_start*subset_size,B_neigs*subset_size*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3657,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3658
3659 if (pcbddc->dbg_flag > 1) {
3660 PetscInt ii;
3661 for (ii=0;ii<B_neigs;ii++) {
3662 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," -> Eigenvector %d/%d (%d)\n",ii,B_neigs,B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3662,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3663 for (j=0;j<B_N;j++) {
3664#if defined(PETSC_USE_COMPLEX)
3665 PetscReal r = PetscRealPart(pcbddc->adaptive_constraints_data[ii*subset_size+j+pcbddc->adaptive_constraints_data_ptr[cum]])(pcbddc->adaptive_constraints_data[ii*subset_size+j+pcbddc
->adaptive_constraints_data_ptr[cum]])
;
3666 PetscReal c = PetscImaginaryPart(pcbddc->adaptive_constraints_data[ii*subset_size+j+pcbddc->adaptive_constraints_data_ptr[cum]])((PetscReal)0.);
3667 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," %1.4e + %1.4e i\n",r,c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3667,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3668#else
3669 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," %1.4e\n",pcbddc->adaptive_constraints_data[ii*subset_size+j+pcbddc->adaptive_constraints_data_ptr[cum]]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3669,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3670#endif
3671 }
3672 }
3673 }
3674 ierr = PetscMemcpy(pcbddc->adaptive_constraints_idxs+pcbddc->adaptive_constraints_idxs_ptr[cum],idxs,subset_size*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3675 pcbddc->adaptive_constraints_idxs_ptr[cum+1] = pcbddc->adaptive_constraints_idxs_ptr[cum] + subset_size;
3676 pcbddc->adaptive_constraints_data_ptr[cum+1] = pcbddc->adaptive_constraints_data_ptr[cum] + subset_size*B_neigs;
3677 cum++;
3678 }
3679 ierr = ISRestoreIndices(sub_schurs->is_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3679,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3680 /* shift for next computation */
3681 cumarray += subset_size*subset_size;
3682 }
3683 if (pcbddc->dbg_flag) {
3684 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3684,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3685 }
3686
3687 if (mss) {
3688 ierr = MatSeqAIJRestoreArray(sub_schurs->sum_S_Ej_inv_all,&Sarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3689 ierr = MatSeqAIJRestoreArray(sub_schurs->sum_S_Ej_tilda_all,&Starray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3689,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3690 /* destroy matrices (junk) */
3691 ierr = MatDestroy(&sub_schurs->sum_S_Ej_inv_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3691,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3692 ierr = MatDestroy(&sub_schurs->sum_S_Ej_tilda_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3693 }
3694 if (allocated_S_St) {
3695 ierr = PetscFree2(S,St)PetscFreeA(2,3695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(S),&(St))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3696 }
3697 ierr = PetscFree5(eigv,eigs,work,B_iwork,B_ifail)PetscFreeA(5,3697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(eigv),&(eigs),&(work),&(B_iwork),&(B_ifail
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3698#if defined(PETSC_USE_COMPLEX)
3699 ierr = PetscFree(rwork)((*PetscTrFree)((void*)(rwork),3699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((rwork) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3700#endif
3701 if (pcbddc->dbg_flag) {
3702 PetscInt maxneigs_r;
3703 ierr = MPIU_Allreduce(&maxneigs,&maxneigs_r,1,MPIU_INT,MPI_MAX,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,3703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&maxneigs),(&
maxneigs_r),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000001
)),(PetscObjectComm((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3704 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Maximum number of constraints per cc %D\n",maxneigs_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3705 }
3706 ierr = PetscLogEventEnd(PC_BDDC_AdaptiveSetUp[pcbddc->current_level],pc,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_AdaptiveSetUp[pcbddc->current_level]].active) ? (
*PetscLogPLE)((PC_BDDC_AdaptiveSetUp[pcbddc->current_level
]),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3707 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3708}
3709
3710PetscErrorCode PCBDDCSetUpSolvers(PC pc)
3711{
3712 PetscScalar *coarse_submat_vals;
3713 PetscErrorCode ierr;
3714
3715 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3715; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3716 /* Setup local scatters R_to_B and (optionally) R_to_D */
3717 /* PCBDDCSetUpLocalWorkVectors should be called first! */
3718 ierr = PCBDDCSetUpLocalScatters(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3719
3720 /* Setup local neumann solver ksp_R */
3721 /* PCBDDCSetUpLocalScatters should be called first! */
3722 ierr = PCBDDCSetUpLocalSolvers(pc,PETSC_FALSE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3722,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3723
3724 /*
3725 Setup local correction and local part of coarse basis.
3726 Gives back the dense local part of the coarse matrix in column major ordering
3727 */
3728 ierr = PCBDDCSetUpCorrection(pc,&coarse_submat_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3728,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3729
3730 /* Compute total number of coarse nodes and setup coarse solver */
3731 ierr = PCBDDCSetUpCoarseSolver(pc,coarse_submat_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3732
3733 /* free */
3734 ierr = PetscFree(coarse_submat_vals)((*PetscTrFree)((void*)(coarse_submat_vals),3734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((coarse_submat_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3735 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3736}
3737
3738PetscErrorCode PCBDDCResetCustomization(PC pc)
3739{
3740 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3741 PetscErrorCode ierr;
3742
3743 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3743; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3744 ierr = ISDestroy(&pcbddc->user_primal_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3744,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3745 ierr = ISDestroy(&pcbddc->user_primal_vertices_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3745,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3746 ierr = ISDestroy(&pcbddc->NeumannBoundaries);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3747 ierr = ISDestroy(&pcbddc->NeumannBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3748 ierr = ISDestroy(&pcbddc->DirichletBoundaries);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3749 ierr = MatNullSpaceDestroy(&pcbddc->onearnullspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3750 ierr = PetscFree(pcbddc->onearnullvecs_state)((*PetscTrFree)((void*)(pcbddc->onearnullvecs_state),3750,
__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->onearnullvecs_state) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3751 ierr = ISDestroy(&pcbddc->DirichletBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3751,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3752 ierr = PCBDDCSetDofsSplitting(pc,0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3753 ierr = PCBDDCSetDofsSplittingLocal(pc,0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3753,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3754 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3755}
3756
3757PetscErrorCode PCBDDCResetTopography(PC pc)
3758{
3759 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3760 PetscInt i;
3761 PetscErrorCode ierr;
3762
3763 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3763; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3764 ierr = MatDestroy(&pcbddc->nedcG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3764,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3765 ierr = ISDestroy(&pcbddc->nedclocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3765,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3766 ierr = MatDestroy(&pcbddc->discretegradient);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3766,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3767 ierr = MatDestroy(&pcbddc->user_ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3767,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3768 ierr = MatDestroy(&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3768,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3769 ierr = MatDestroy(&pcbddc->switch_static_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3770 ierr = VecDestroy(&pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3770,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3771 ierr = MatDestroy(&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3771,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3772 ierr = MatDestroy(&pcbddc->divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3773 ierr = ISDestroy(&pcbddc->divudotp_vl2l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3774 ierr = PCBDDCGraphDestroy(&pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3774,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3775 for (i=0;i<pcbddc->n_local_subs;i++) {
3776 ierr = ISDestroy(&pcbddc->local_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3776,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3777 }
3778 pcbddc->n_local_subs = 0;
3779 ierr = PetscFree(pcbddc->local_subs)((*PetscTrFree)((void*)(pcbddc->local_subs),3779,__func__,
"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->local_subs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3780 ierr = PCBDDCSubSchursDestroy(&pcbddc->sub_schurs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3780,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3781 pcbddc->graphanalyzed = PETSC_FALSE;
3782 pcbddc->recompute_topography = PETSC_TRUE;
3783 pcbddc->corner_selected = PETSC_FALSE;
3784 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3785}
3786
3787PetscErrorCode PCBDDCResetSolvers(PC pc)
3788{
3789 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3790 PetscErrorCode ierr;
3791
3792 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3792; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3793 ierr = VecDestroy(&pcbddc->coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3794 if (pcbddc->coarse_phi_B) {
3795 PetscScalar *array;
3796 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3796,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3797 ierr = PetscFree(array)((*PetscTrFree)((void*)(array),3797,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((array) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3797,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3798 }
3799 ierr = MatDestroy(&pcbddc->coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3799,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3800 ierr = MatDestroy(&pcbddc->coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3800,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3801 ierr = MatDestroy(&pcbddc->coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3802 ierr = MatDestroy(&pcbddc->coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3803 ierr = VecDestroy(&pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3804 ierr = VecDestroy(&pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3804,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3805 ierr = MatDestroy(&pcbddc->local_auxmat2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3806 ierr = MatDestroy(&pcbddc->local_auxmat1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3807 ierr = VecDestroy(&pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3807,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3808 ierr = VecDestroy(&pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3809 ierr = ISDestroy(&pcbddc->is_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3809,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3810 ierr = VecScatterDestroy(&pcbddc->R_to_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3810,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3811 ierr = VecScatterDestroy(&pcbddc->R_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3811,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3812 ierr = VecScatterDestroy(&pcbddc->coarse_loc_to_glob);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3813 ierr = KSPReset(pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3813,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3814 ierr = KSPReset(pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3814,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3815 ierr = KSPReset(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3815,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3816 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3816,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3817 ierr = PetscFree(pcbddc->primal_indices_local_idxs)((*PetscTrFree)((void*)(pcbddc->primal_indices_local_idxs)
,3817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->primal_indices_local_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3818 ierr = PetscFree2(pcbddc->local_primal_ref_node,pcbddc->local_primal_ref_mult)PetscFreeA(2,3818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->local_primal_ref_node),&(pcbddc->local_primal_ref_mult
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3819 ierr = PetscFree(pcbddc->global_primal_indices)((*PetscTrFree)((void*)(pcbddc->global_primal_indices),3819
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->global_primal_indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3820 ierr = ISDestroy(&pcbddc->coarse_subassembling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3821 ierr = MatDestroy(&pcbddc->benign_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3822 ierr = VecDestroy(&pcbddc->benign_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3822,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3823 ierr = PCBDDCBenignShellMat(pc,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3824 ierr = MatDestroy(&pcbddc->benign_B0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3825 ierr = PetscSFDestroy(&pcbddc->benign_sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3826 if (pcbddc->benign_zerodiag_subs) {
3827 PetscInt i;
3828 for (i=0;i<pcbddc->benign_n;i++) {
3829 ierr = ISDestroy(&pcbddc->benign_zerodiag_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3829,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3830 }
3831 ierr = PetscFree(pcbddc->benign_zerodiag_subs)((*PetscTrFree)((void*)(pcbddc->benign_zerodiag_subs),3831
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->benign_zerodiag_subs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3831,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3832 }
3833 ierr = PetscFree3(pcbddc->benign_p0_lidx,pcbddc->benign_p0_gidx,pcbddc->benign_p0)PetscFreeA(3,3833,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->benign_p0_lidx),&(pcbddc->benign_p0_gidx
),&(pcbddc->benign_p0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3833,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3834 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3835}
3836
3837PetscErrorCode PCBDDCSetUpLocalWorkVectors(PC pc)
3838{
3839 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3840 PC_IS *pcis = (PC_IS*)pc->data;
3841 VecType impVecType;
3842 PetscInt n_constraints,n_R,old_size;
3843 PetscErrorCode ierr;
3844
3845 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3845; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3846 n_constraints = pcbddc->local_primal_size - pcbddc->benign_n - pcbddc->n_vertices;
3847 n_R = pcis->n - pcbddc->n_vertices;
3848 ierr = VecGetType(pcis->vec1_N,&impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3848,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3849 /* local work vectors (try to avoid unneeded work)*/
3850 /* R nodes */
3851 old_size = -1;
3852 if (pcbddc->vec1_R) {
3853 ierr = VecGetSize(pcbddc->vec1_R,&old_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3853,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3854 }
3855 if (n_R != old_size) {
3856 ierr = VecDestroy(&pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3857 ierr = VecDestroy(&pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3857,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3858 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3859 ierr = VecSetSizes(pcbddc->vec1_R,PETSC_DECIDE-1,n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3860 ierr = VecSetType(pcbddc->vec1_R,impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3861 ierr = VecDuplicate(pcbddc->vec1_R,&pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3862 }
3863 /* local primal dofs */
3864 old_size = -1;
3865 if (pcbddc->vec1_P) {
3866 ierr = VecGetSize(pcbddc->vec1_P,&old_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3867 }
3868 if (pcbddc->local_primal_size != old_size) {
3869 ierr = VecDestroy(&pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3870 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3870,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3871 ierr = VecSetSizes(pcbddc->vec1_P,PETSC_DECIDE-1,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3871,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3872 ierr = VecSetType(pcbddc->vec1_P,impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3872,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3873 }
3874 /* local explicit constraints */
3875 old_size = -1;
3876 if (pcbddc->vec1_C) {
3877 ierr = VecGetSize(pcbddc->vec1_C,&old_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3877,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3878 }
3879 if (n_constraints && n_constraints != old_size) {
3880 ierr = VecDestroy(&pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3880,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3881 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3881,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3882 ierr = VecSetSizes(pcbddc->vec1_C,PETSC_DECIDE-1,n_constraints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3882,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3883 ierr = VecSetType(pcbddc->vec1_C,impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3883,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3884 }
3885 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3886}
3887
3888PetscErrorCode PCBDDCSetUpCorrection(PC pc, PetscScalar **coarse_submat_vals_n)
3889{
3890 PetscErrorCode ierr;
3891 /* pointers to pcis and pcbddc */
3892 PC_IS* pcis = (PC_IS*)pc->data;
3893 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
3894 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
3895 /* submatrices of local problem */
3896 Mat A_RV,A_VR,A_VV,local_auxmat2_R;
3897 /* submatrices of local coarse problem */
3898 Mat S_VV,S_CV,S_VC,S_CC;
3899 /* working matrices */
3900 Mat C_CR;
3901 /* additional working stuff */
3902 PC pc_R;
3903 Mat F,Brhs = NULL((void*)0);
3904 Vec dummy_vec;
3905 PetscBool isLU,isCHOL,isILU,need_benign_correction,sparserhs;
3906 PetscScalar *coarse_submat_vals; /* TODO: use a PETSc matrix */
3907 PetscScalar *work;
3908 PetscInt *idx_V_B;
3909 PetscInt lda_rhs,n,n_vertices,n_constraints,*p0_lidx_I;
3910 PetscInt i,n_R,n_D,n_B;
3911
3912 /* some shortcuts to scalars */
3913 PetscScalar one=1.0,m_one=-1.0;
3914
3915 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3915; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3916 if (!pcbddc->symmetric_primal && pcbddc->benign_n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Non-symmetric primal basis computation with benign trick not yet implemented")return PetscError(((MPI_Comm)0x44000001),3916,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Non-symmetric primal basis computation with benign trick not yet implemented"
)
;
3917 ierr = PetscLogEventBegin(PC_BDDC_CorrectionSetUp[pcbddc->current_level],pc,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_CorrectionSetUp[pcbddc->current_level]].active) ?
(*PetscLogPLB)((PC_BDDC_CorrectionSetUp[pcbddc->current_level
]),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3918
3919 /* Set Non-overlapping dimensions */
3920 n_vertices = pcbddc->n_vertices;
3921 n_constraints = pcbddc->local_primal_size - pcbddc->benign_n - n_vertices;
3922 n_B = pcis->n_B;
3923 n_D = pcis->n - n_B;
3924 n_R = pcis->n - n_vertices;
3925
3926 /* vertices in boundary numbering */
3927 ierr = PetscMalloc1(n_vertices,&idx_V_B)PetscMallocA(1,PETSC_FALSE,3927,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_vertices)*sizeof(**(&idx_V_B)),(&idx_V_B)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3927,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3928 ierr = ISGlobalToLocalMappingApply(pcis->BtoNmap,IS_GTOLM_DROP,n_vertices,pcbddc->local_primal_ref_node,&i,idx_V_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3928,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3929 if (i != n_vertices) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error in boundary numbering for BDDC vertices! %D != %D",n_vertices,i)return PetscError(((MPI_Comm)0x44000001),3929,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error in boundary numbering for BDDC vertices! %D != %D"
,n_vertices,i)
;
3930
3931 /* Subdomain contribution (Non-overlapping) to coarse matrix */
3932 ierr = PetscCalloc1(pcbddc->local_primal_size*pcbddc->local_primal_size,&coarse_submat_vals)PetscMallocA(1,PETSC_TRUE,3932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->local_primal_size*pcbddc->local_primal_size
)*sizeof(**(&coarse_submat_vals)),(&coarse_submat_vals
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3933 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_vertices,n_vertices,coarse_submat_vals,&S_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3934 ierr = MatSeqDenseSetLDA(S_VV,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3935 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_constraints,n_vertices,coarse_submat_vals+n_vertices,&S_CV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3935,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3936 ierr = MatSeqDenseSetLDA(S_CV,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3936,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3937 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_vertices,n_constraints,coarse_submat_vals+pcbddc->local_primal_size*n_vertices,&S_VC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3938 ierr = MatSeqDenseSetLDA(S_VC,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3939 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_constraints,n_constraints,coarse_submat_vals+(pcbddc->local_primal_size+1)*n_vertices,&S_CC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3940 ierr = MatSeqDenseSetLDA(S_CC,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3940,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3941
3942 /* determine if can use MatSolve routines instead of calling KSPSolve on ksp_R */
3943 ierr = KSPGetPC(pcbddc->ksp_R,&pc_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3944 ierr = PCSetUp(pc_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3945 ierr = PetscObjectTypeCompare((PetscObject)pc_R,PCLU"lu",&isLU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3945,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3946 ierr = PetscObjectTypeCompare((PetscObject)pc_R,PCILU"ilu",&isILU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3946,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3947 ierr = PetscObjectTypeCompare((PetscObject)pc_R,PCCHOLESKY"cholesky",&isCHOL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3947,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3948 lda_rhs = n_R;
3949 need_benign_correction = PETSC_FALSE;
3950 if (isLU || isILU || isCHOL) {
3951 ierr = PCFactorGetMatrix(pc_R,&F);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3951,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3952 } else if (sub_schurs && sub_schurs->reuse_solver) {
3953 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
3954 MatFactorType type;
3955
3956 F = reuse_solver->F;
3957 ierr = MatGetFactorType(F,&type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3957,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3958 if (type == MAT_FACTOR_CHOLESKY) isCHOL = PETSC_TRUE;
3959 ierr = MatGetSize(F,&lda_rhs,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3960 need_benign_correction = (PetscBool)(!!reuse_solver->benign_n);
3961 } else {
3962 F = NULL((void*)0);
3963 }
3964
3965 /* determine if we can use a sparse right-hand side */
3966 sparserhs = PETSC_FALSE;
3967 if (F) {
3968 MatSolverType solver;
3969
3970 ierr = MatFactorGetSolverType(F,&solver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3970,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3971 ierr = PetscStrcmp(solver,MATSOLVERMUMPS"mumps",&sparserhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3972 }
3973
3974 /* allocate workspace */
3975 n = 0;
3976 if (n_constraints) {
3977 n += lda_rhs*n_constraints;
3978 }
3979 if (n_vertices) {
3980 n = PetscMax(2*lda_rhs*n_vertices,n)(((2*lda_rhs*n_vertices)<(n)) ? (n) : (2*lda_rhs*n_vertices
))
;
3981 n = PetscMax((lda_rhs+n_B)*n_vertices,n)((((lda_rhs+n_B)*n_vertices)<(n)) ? (n) : ((lda_rhs+n_B)*n_vertices
))
;
3982 }
3983 if (!pcbddc->symmetric_primal) {
3984 n = PetscMax(2*lda_rhs*pcbddc->local_primal_size,n)(((2*lda_rhs*pcbddc->local_primal_size)<(n)) ? (n) : (2
*lda_rhs*pcbddc->local_primal_size))
;
3985 }
3986 ierr = PetscMalloc1(n,&work)PetscMallocA(1,PETSC_FALSE,3986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&work)),(&work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3987
3988 /* create dummy vector to modify rhs and sol of MatMatSolve (work array will never be used) */
3989 dummy_vec = NULL((void*)0);
3990 if (need_benign_correction && lda_rhs != n_R && F) {
3991 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3991,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3992 ierr = VecSetSizes(dummy_vec,lda_rhs,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3993 ierr = VecSetType(dummy_vec,((PetscObject)pcis->vec1_N)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3993,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3994 }
3995
3996 /* Precompute stuffs needed for preprocessing and application of BDDC*/
3997 if (n_constraints) {
3998 Mat M3,C_B;
3999 IS is_aux;
4000 PetscScalar *array,*array2;
4001
4002 ierr = MatDestroy(&pcbddc->local_auxmat1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4002,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4003 ierr = MatDestroy(&pcbddc->local_auxmat2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4003,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4004
4005 /* Extract constraints on R nodes: C_{CR} */
4006 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_constraints,n_vertices,1,&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4006,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4007 ierr = MatCreateSubMatrix(pcbddc->ConstraintMatrix,is_aux,pcbddc->is_R_local,MAT_INITIAL_MATRIX,&C_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4007,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4008 ierr = MatCreateSubMatrix(pcbddc->ConstraintMatrix,is_aux,pcis->is_B_local,MAT_INITIAL_MATRIX,&C_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4008,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4009
4010 /* Assemble local_auxmat2_R = (- A_{RR}^{-1} C^T_{CR}) needed by BDDC setup */
4011 /* Assemble pcbddc->local_auxmat2 = R_to_B (- A_{RR}^{-1} C^T_{CR}) needed by BDDC application */
4012 if (!sparserhs) {
4013 ierr = PetscMemzero(work,lda_rhs*n_constraints*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4013,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4014 for (i=0;i<n_constraints;i++) {
4015 const PetscScalar *row_cmat_values;
4016 const PetscInt *row_cmat_indices;
4017 PetscInt size_of_constraint,j;
4018
4019 ierr = MatGetRow(C_CR,i,&size_of_constraint,&row_cmat_indices,&row_cmat_values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4019,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4020 for (j=0;j<size_of_constraint;j++) {
4021 work[row_cmat_indices[j]+i*lda_rhs] = -row_cmat_values[j];
4022 }
4023 ierr = MatRestoreRow(C_CR,i,&size_of_constraint,&row_cmat_indices,&row_cmat_values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4023,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4024 }
4025 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),lda_rhs,n_constraints,work,&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4025,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4026 } else {
4027 Mat tC_CR;
4028
4029 ierr = MatScale(C_CR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4030 if (lda_rhs != n_R) {
4031 PetscScalar *aa;
4032 PetscInt r,*ii,*jj;
4033 PetscBool done;
4034
4035 ierr = MatGetRowIJ(C_CR,0,PETSC_FALSE,PETSC_FALSE,&r,(const PetscInt**)&ii,(const PetscInt**)&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4035,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4036 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"GetRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4036,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"GetRowIJ failed")
;
4037 ierr = MatSeqAIJGetArray(C_CR,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4037,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4038 ierr = MatCreateSeqAIJWithArrays(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_constraints,lda_rhs,ii,jj,aa,&tC_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4038,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4039 ierr = MatRestoreRowIJ(C_CR,0,PETSC_FALSE,PETSC_FALSE,&r,(const PetscInt**)&ii,(const PetscInt**)&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4039,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4040 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"RestoreRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4040,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"RestoreRowIJ failed")
;
4041 } else {
4042 ierr = PetscObjectReference((PetscObject)C_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4042,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4043 tC_CR = C_CR;
4044 }
4045 ierr = MatCreateTranspose(tC_CR,&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4045,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4046 ierr = MatDestroy(&tC_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4046,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4047 }
4048 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),lda_rhs,n_constraints,NULL((void*)0),&local_auxmat2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4048,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4049 if (F) {
4050 if (need_benign_correction) {
4051 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4052
4053 /* rhs is already zero on interior dofs, no need to change the rhs */
4054 ierr = PetscMemzero(reuse_solver->benign_save_vals,pcbddc->benign_n*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4054,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4055 }
4056 ierr = MatMatSolve(F,Brhs,local_auxmat2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4057 if (need_benign_correction) {
4058 PetscScalar *marr;
4059 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4060
4061 ierr = MatDenseGetArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4061,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4062 if (lda_rhs != n_R) {
4063 for (i=0;i<n_constraints;i++) {
4064 ierr = VecPlaceArray(dummy_vec,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4065 ierr = PCBDDCReuseSolversBenignAdapt(reuse_solver,dummy_vec,NULL((void*)0),PETSC_TRUE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4066 ierr = VecResetArray(dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4067 }
4068 } else {
4069 for (i=0;i<n_constraints;i++) {
4070 ierr = VecPlaceArray(pcbddc->vec1_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4071 ierr = PCBDDCReuseSolversBenignAdapt(reuse_solver,pcbddc->vec1_R,NULL((void*)0),PETSC_TRUE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4071,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4072 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4073 }
4074 }
4075 ierr = MatDenseRestoreArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4076 }
4077 } else {
4078 PetscScalar *marr;
4079
4080 ierr = MatDenseGetArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4081 for (i=0;i<n_constraints;i++) {
4082 ierr = VecPlaceArray(pcbddc->vec1_R,work+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4082,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4083 ierr = VecPlaceArray(pcbddc->vec2_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4084 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4084,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4085 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4085,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4086 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4086,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4087 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4087,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4088 }
4089 ierr = MatDenseRestoreArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4089,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4090 }
4091 if (sparserhs) {
4092 ierr = MatScale(C_CR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4092,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4093 }
4094 ierr = MatDestroy(&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4094,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4095 if (!pcbddc->switch_static) {
4096 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_B,n_constraints,NULL((void*)0),&pcbddc->local_auxmat2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4096,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4097 ierr = MatDenseGetArray(pcbddc->local_auxmat2,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4097,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4098 ierr = MatDenseGetArray(local_auxmat2_R,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4098,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4099 for (i=0;i<n_constraints;i++) {
4100 ierr = VecPlaceArray(pcbddc->vec1_R,array2+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4101 ierr = VecPlaceArray(pcis->vec1_B,array+i*n_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4101,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4102 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4102,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4103 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4104 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4104,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4105 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4105,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4106 }
4107 ierr = MatDenseRestoreArray(local_auxmat2_R,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4107,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4108 ierr = MatDenseRestoreArray(pcbddc->local_auxmat2,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4109 ierr = MatMatMult(C_B,pcbddc->local_auxmat2,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&M3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4109,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4110 } else {
4111 if (lda_rhs != n_R) {
4112 IS dummy;
4113
4114 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_R,0,1,&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4115 ierr = MatCreateSubMatrix(local_auxmat2_R,dummy,NULL((void*)0),MAT_INITIAL_MATRIX,&pcbddc->local_auxmat2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4115,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4116 ierr = ISDestroy(&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4116,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4117 } else {
4118 ierr = PetscObjectReference((PetscObject)local_auxmat2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4118,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4119 pcbddc->local_auxmat2 = local_auxmat2_R;
4120 }
4121 ierr = MatMatMult(C_CR,pcbddc->local_auxmat2,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&M3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4121,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4122 }
4123 ierr = ISDestroy(&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4123,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4124 /* Assemble explicitly S_CC = ( C_{CR} A_{RR}^{-1} C^T_{CR} )^{-1} */
4125 ierr = MatScale(M3,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4125,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4126 if (isCHOL) {
4127 ierr = MatCholeskyFactor(M3,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4128 } else {
4129 ierr = MatLUFactor(M3,NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4129,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4130 }
4131 ierr = MatSeqDenseInvertFactors_Private(M3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4132 /* Assemble local_auxmat1 = S_CC*C_{CB} needed by BDDC application in KSP and in preproc */
4133 ierr = MatMatMult(M3,C_B,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&pcbddc->local_auxmat1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4134 ierr = MatDestroy(&C_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4134,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4135 ierr = MatCopy(M3,S_CC,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4135,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* S_CC can have a different LDA, MatMatSolve doesn't support it */
4136 ierr = MatDestroy(&M3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4136,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4137 }
4138
4139 /* Get submatrices from subdomain matrix */
4140 if (n_vertices) {
4141 IS is_aux;
4142 PetscBool isseqaij;
4143
4144 if (sub_schurs && sub_schurs->reuse_solver) { /* is_R_local is not sorted, ISComplement doesn't like it */
4145 IS tis;
4146
4147 ierr = ISDuplicate(pcbddc->is_R_local,&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4147,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4148 ierr = ISSort(tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4148,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4149 ierr = ISComplement(tis,0,pcis->n,&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4149,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4150 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4150,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4151 } else {
4152 ierr = ISComplement(pcbddc->is_R_local,0,pcis->n,&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4152,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4153 }
4154 ierr = MatCreateSubMatrix(pcbddc->local_mat,pcbddc->is_R_local,is_aux,MAT_INITIAL_MATRIX,&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4154,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4155 ierr = MatCreateSubMatrix(pcbddc->local_mat,is_aux,pcbddc->is_R_local,MAT_INITIAL_MATRIX,&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4155,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4156 ierr = PetscObjectTypeCompare((PetscObject)A_VR,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4156,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4157 if (!isseqaij) { /* MatMatMult(A_VR,A_RRmA_RV) below will raise an error */
4158 ierr = MatConvert(A_VR,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4158,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4159 }
4160 ierr = MatCreateSubMatrix(pcbddc->local_mat,is_aux,is_aux,MAT_INITIAL_MATRIX,&A_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4160,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4161 ierr = ISDestroy(&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4161,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4162 }
4163
4164 /* Matrix of coarse basis functions (local) */
4165 if (pcbddc->coarse_phi_B) {
4166 PetscInt on_B,on_primal,on_D=n_D;
4167 if (pcbddc->coarse_phi_D) {
4168 ierr = MatGetSize(pcbddc->coarse_phi_D,&on_D,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4169 }
4170 ierr = MatGetSize(pcbddc->coarse_phi_B,&on_B,&on_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4170,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4171 if (on_B != n_B || on_primal != pcbddc->local_primal_size || on_D != n_D) {
4172 PetscScalar *marray;
4173
4174 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4175 ierr = PetscFree(marray)((*PetscTrFree)((void*)(marray),4175,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((marray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4175,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4176 ierr = MatDestroy(&pcbddc->coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4176,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4177 ierr = MatDestroy(&pcbddc->coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4177,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4178 ierr = MatDestroy(&pcbddc->coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4178,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4179 ierr = MatDestroy(&pcbddc->coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4180 }
4181 }
4182
4183 if (!pcbddc->coarse_phi_B) {
4184 PetscScalar *marr;
4185
4186 /* memory size */
4187 n = n_B*pcbddc->local_primal_size;
4188 if (pcbddc->switch_static || pcbddc->dbg_flag) n += n_D*pcbddc->local_primal_size;
4189 if (!pcbddc->symmetric_primal) n *= 2;
4190 ierr = PetscCalloc1(n,&marr)PetscMallocA(1,PETSC_TRUE,4190,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&marr)),(&marr))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4190,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4191 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_B,pcbddc->local_primal_size,marr,&pcbddc->coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4191,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4192 marr += n_B*pcbddc->local_primal_size;
4193 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4194 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_D,pcbddc->local_primal_size,marr,&pcbddc->coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4194,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4195 marr += n_D*pcbddc->local_primal_size;
4196 }
4197 if (!pcbddc->symmetric_primal) {
4198 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_B,pcbddc->local_primal_size,marr,&pcbddc->coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4198,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4199 marr += n_B*pcbddc->local_primal_size;
4200 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4201 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_D,pcbddc->local_primal_size,marr,&pcbddc->coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4201,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4202 }
4203 } else {
4204 ierr = PetscObjectReference((PetscObject)pcbddc->coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4205 pcbddc->coarse_psi_B = pcbddc->coarse_phi_B;
4206 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4207 ierr = PetscObjectReference((PetscObject)pcbddc->coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4207,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4208 pcbddc->coarse_psi_D = pcbddc->coarse_phi_D;
4209 }
4210 }
4211 }
4212
4213 /* We are now ready to evaluate coarse basis functions and subdomain contribution to coarse problem */
4214 p0_lidx_I = NULL((void*)0);
4215 if (pcbddc->benign_n && (pcbddc->switch_static || pcbddc->dbg_flag)) {
4216 const PetscInt *idxs;
4217
4218 ierr = ISGetIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4219 ierr = PetscMalloc1(pcbddc->benign_n,&p0_lidx_I)PetscMallocA(1,PETSC_FALSE,4219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->benign_n)*sizeof(**(&p0_lidx_I)),(&
p0_lidx_I))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4220 for (i=0;i<pcbddc->benign_n;i++) {
4221 ierr = PetscFindInt(pcbddc->benign_p0_lidx[i],pcis->n-pcis->n_B,idxs,&p0_lidx_I[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4221,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4222 }
4223 ierr = ISRestoreIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4224 }
4225
4226 /* vertices */
4227 if (n_vertices) {
4228 PetscBool restoreavr = PETSC_FALSE;
4229
4230 ierr = MatConvert(A_VV,MATDENSE"dense",MAT_INPLACE_MATRIX,&A_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4230,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4231
4232 if (n_R) {
4233 Mat A_RRmA_RV,A_RV_bcorr=NULL((void*)0),S_VVt; /* S_VVt with LDA=N */
4234 PetscBLASInt B_N,B_one = 1;
4235 PetscScalar *x,*y;
4236
4237 ierr = MatScale(A_RV,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4237,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4238 if (need_benign_correction) {
4239 ISLocalToGlobalMapping RtoN;
4240 IS is_p0;
4241 PetscInt *idxs_p0,n;
4242
4243 ierr = PetscMalloc1(pcbddc->benign_n,&idxs_p0)PetscMallocA(1,PETSC_FALSE,4243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->benign_n)*sizeof(**(&idxs_p0)),(&
idxs_p0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4244 ierr = ISLocalToGlobalMappingCreateIS(pcbddc->is_R_local,&RtoN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4244,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4245 ierr = ISGlobalToLocalMappingApply(RtoN,IS_GTOLM_DROP,pcbddc->benign_n,pcbddc->benign_p0_lidx,&n,idxs_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4246 if (n != pcbddc->benign_n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error in R numbering for benign p0! %D != %D",n,pcbddc->benign_n)return PetscError(((MPI_Comm)0x44000001),4246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error in R numbering for benign p0! %D != %D"
,n,pcbddc->benign_n)
;
4247 ierr = ISLocalToGlobalMappingDestroy(&RtoN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4248 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),n,idxs_p0,PETSC_OWN_POINTER,&is_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4249 ierr = MatCreateSubMatrix(A_RV,is_p0,NULL((void*)0),MAT_INITIAL_MATRIX,&A_RV_bcorr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4250 ierr = ISDestroy(&is_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4251 }
4252
4253 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),lda_rhs,n_vertices,work,&A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4254 if (!sparserhs || need_benign_correction) {
4255 if (lda_rhs == n_R) {
4256 ierr = MatConvert(A_RV,MATDENSE"dense",MAT_INPLACE_MATRIX,&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4257 } else {
4258 PetscScalar *av,*array;
4259 const PetscInt *xadj,*adjncy;
4260 PetscInt n;
4261 PetscBool flg_row;
4262
4263 array = work+lda_rhs*n_vertices;
4264 ierr = PetscMemzero(array,lda_rhs*n_vertices*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4265 ierr = MatConvert(A_RV,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4266 ierr = MatGetRowIJ(A_RV,0,PETSC_FALSE,PETSC_FALSE,&n,&xadj,&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4266,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4267 ierr = MatSeqAIJGetArray(A_RV,&av);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4268 for (i=0;i<n;i++) {
4269 PetscInt j;
4270 for (j=xadj[i];j<xadj[i+1];j++) array[lda_rhs*adjncy[j]+i] = av[j];
4271 }
4272 ierr = MatRestoreRowIJ(A_RV,0,PETSC_FALSE,PETSC_FALSE,&n,&xadj,&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4272,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4273 ierr = MatDestroy(&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4274 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),lda_rhs,n_vertices,array,&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4274,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4275 }
4276 if (need_benign_correction) {
4277 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4278 PetscScalar *marr;
4279
4280 ierr = MatDenseGetArray(A_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4280,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4281 /* need \Phi^T A_RV = (I+L)A_RV, L given by
4282
4283 | 0 0 0 | (V)
4284 L = | 0 0 -1 | (P-p0)
4285 | 0 0 -1 | (p0)
4286
4287 */
4288 for (i=0;i<reuse_solver->benign_n;i++) {
4289 const PetscScalar *vals;
4290 const PetscInt *idxs,*idxs_zero;
4291 PetscInt n,j,nz;
4292
4293 ierr = ISGetLocalSize(reuse_solver->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4293,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4294 ierr = ISGetIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4294,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4295 ierr = MatGetRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4296 for (j=0;j<n;j++) {
4297 PetscScalar val = vals[j];
4298 PetscInt k,col = idxs[j];
4299 for (k=0;k<nz;k++) marr[idxs_zero[k]+lda_rhs*col] -= val;
4300 }
4301 ierr = MatRestoreRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4302 ierr = ISRestoreIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4302,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4303 }
4304 ierr = MatDenseRestoreArray(A_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4304,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4305 }
4306 ierr = PetscObjectReference((PetscObject)A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4307 Brhs = A_RV;
4308 } else {
4309 Mat tA_RVT,A_RVT;
4310
4311 if (!pcbddc->symmetric_primal) {
4312 /* A_RV already scaled by -1 */
4313 ierr = MatTranspose(A_RV,MAT_INITIAL_MATRIX,&A_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4313,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4314 } else {
4315 restoreavr = PETSC_TRUE;
4316 ierr = MatScale(A_VR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4316,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4317 ierr = PetscObjectReference((PetscObject)A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4317,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4318 A_RVT = A_VR;
4319 }
4320 if (lda_rhs != n_R) {
4321 PetscScalar *aa;
4322 PetscInt r,*ii,*jj;
4323 PetscBool done;
4324
4325 ierr = MatGetRowIJ(A_RVT,0,PETSC_FALSE,PETSC_FALSE,&r,(const PetscInt**)&ii,(const PetscInt**)&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4325,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4326 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"GetRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4326,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"GetRowIJ failed")
;
4327 ierr = MatSeqAIJGetArray(A_RVT,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4327,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4328 ierr = MatCreateSeqAIJWithArrays(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_vertices,lda_rhs,ii,jj,aa,&tA_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4328,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4329 ierr = MatRestoreRowIJ(A_RVT,0,PETSC_FALSE,PETSC_FALSE,&r,(const PetscInt**)&ii,(const PetscInt**)&jj,&done);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4329,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4330 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"RestoreRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4330,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"RestoreRowIJ failed")
;
4331 } else {
4332 ierr = PetscObjectReference((PetscObject)A_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4332,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4333 tA_RVT = A_RVT;
4334 }
4335 ierr = MatCreateTranspose(tA_RVT,&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4335,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4336 ierr = MatDestroy(&tA_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4337 ierr = MatDestroy(&A_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4337,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4338 }
4339 if (F) {
4340 /* need to correct the rhs */
4341 if (need_benign_correction) {
4342 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4343 PetscScalar *marr;
4344
4345 ierr = MatDenseGetArray(Brhs,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4346 if (lda_rhs != n_R) {
4347 for (i=0;i<n_vertices;i++) {
4348 ierr = VecPlaceArray(dummy_vec,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4348,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4349 ierr = PCBDDCReuseSolversBenignAdapt(reuse_solver,dummy_vec,NULL((void*)0),PETSC_FALSE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4349,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4350 ierr = VecResetArray(dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4351 }
4352 } else {
4353 for (i=0;i<n_vertices;i++) {
4354 ierr = VecPlaceArray(pcbddc->vec1_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4355 ierr = PCBDDCReuseSolversBenignAdapt(reuse_solver,pcbddc->vec1_R,NULL((void*)0),PETSC_FALSE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4356 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4357 }
4358 }
4359 ierr = MatDenseRestoreArray(Brhs,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4359,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4360 }
4361 ierr = MatMatSolve(F,Brhs,A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4361,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4362 if (restoreavr) {
4363 ierr = MatScale(A_VR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4364 }
4365 /* need to correct the solution */
4366 if (need_benign_correction) {
4367 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4368 PetscScalar *marr;
4369
4370 ierr = MatDenseGetArray(A_RRmA_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4370,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4371 if (lda_rhs != n_R) {
4372 for (i=0;i<n_vertices;i++) {
4373 ierr = VecPlaceArray(dummy_vec,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4374 ierr = PCBDDCReuseSolversBenignAdapt(reuse_solver,dummy_vec,NULL((void*)0),PETSC_TRUE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4374,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4375 ierr = VecResetArray(dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4376 }
4377 } else {
4378 for (i=0;i<n_vertices;i++) {
4379 ierr = VecPlaceArray(pcbddc->vec1_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4379,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4380 ierr = PCBDDCReuseSolversBenignAdapt(reuse_solver,pcbddc->vec1_R,NULL((void*)0),PETSC_TRUE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4380,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4381 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4382 }
4383 }
4384 ierr = MatDenseRestoreArray(A_RRmA_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4385 }
4386 } else {
4387 ierr = MatDenseGetArray(Brhs,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4387,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4388 for (i=0;i<n_vertices;i++) {
4389 ierr = VecPlaceArray(pcbddc->vec1_R,y+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4389,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4390 ierr = VecPlaceArray(pcbddc->vec2_R,work+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4391 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4391,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4392 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4393 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4393,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4394 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4394,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4395 }
4396 ierr = MatDenseRestoreArray(Brhs,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4396,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4397 }
4398 ierr = MatDestroy(&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4398,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4399 ierr = MatDestroy(&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4399,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4400 /* S_VV and S_CV */
4401 if (n_constraints) {
4402 Mat B;
4403
4404 ierr = PetscMemzero(work+lda_rhs*n_vertices,n_B*n_vertices*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4405 for (i=0;i<n_vertices;i++) {
4406 ierr = VecPlaceArray(pcbddc->vec1_R,work+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4406,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4407 ierr = VecPlaceArray(pcis->vec1_B,work+lda_rhs*n_vertices+i*n_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4407,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4408 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4408,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4409 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4410 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4410,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4411 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4411,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4412 }
4413 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_B,n_vertices,work+lda_rhs*n_vertices,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4413,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4414 ierr = MatMatMult(pcbddc->local_auxmat1,B,MAT_REUSE_MATRIX,PETSC_DEFAULT-2,&S_CV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4414,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4415 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4416 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),lda_rhs,n_vertices,work+lda_rhs*n_vertices,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4416,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4417 ierr = MatMatMult(local_auxmat2_R,S_CV,MAT_REUSE_MATRIX,PETSC_DEFAULT-2,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4418 ierr = MatScale(S_CV,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4418,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4419 ierr = PetscBLASIntCast(lda_rhs*n_vertices,&B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4419,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4420 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&B_N,&one,work+lda_rhs*n_vertices,&B_one,work,&B_one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASaxpy"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 4420; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
daxpy_(&B_N,&one,work+lda_rhs*n_vertices,&B_one,
work,&B_one); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(4420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),4420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
4421 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4421,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4422 }
4423 if (lda_rhs != n_R) {
4424 ierr = MatDestroy(&A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4425 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_R,n_vertices,work,&A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4425,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4426 ierr = MatSeqDenseSetLDA(A_RRmA_RV,lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4426,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4427 }
4428 ierr = MatMatMult(A_VR,A_RRmA_RV,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&S_VVt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4429 /* need A_VR * \Phi * A_RRmA_RV = A_VR * (I+L)^T * A_RRmA_RV, L given as before */
4430 if (need_benign_correction) {
4431 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4432 PetscScalar *marr,*sums;
4433
4434 ierr = PetscMalloc1(n_vertices,&sums)PetscMallocA(1,PETSC_FALSE,4434,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_vertices)*sizeof(**(&sums)),(&sums))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4434,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4435 ierr = MatDenseGetArray(S_VVt,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4435,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4436 for (i=0;i<reuse_solver->benign_n;i++) {
4437 const PetscScalar *vals;
4438 const PetscInt *idxs,*idxs_zero;
4439 PetscInt n,j,nz;
4440
4441 ierr = ISGetLocalSize(reuse_solver->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4441,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4442 ierr = ISGetIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4442,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4443 for (j=0;j<n_vertices;j++) {
4444 PetscInt k;
4445 sums[j] = 0.;
4446 for (k=0;k<nz;k++) sums[j] += work[idxs_zero[k]+j*lda_rhs];
4447 }
4448 ierr = MatGetRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4448,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4449 for (j=0;j<n;j++) {
4450 PetscScalar val = vals[j];
4451 PetscInt k;
4452 for (k=0;k<n_vertices;k++) {
4453 marr[idxs[j]+k*n_vertices] += val*sums[k];
4454 }
4455 }
4456 ierr = MatRestoreRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4456,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4457 ierr = ISRestoreIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4457,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4458 }
4459 ierr = PetscFree(sums)((*PetscTrFree)((void*)(sums),4459,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((sums) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4459,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4460 ierr = MatDenseRestoreArray(S_VVt,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4460,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4461 ierr = MatDestroy(&A_RV_bcorr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4461,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4462 }
4463 ierr = MatDestroy(&A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4464 ierr = PetscBLASIntCast(n_vertices*n_vertices,&B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4465 ierr = MatDenseGetArray(A_VV,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4465,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4466 ierr = MatDenseGetArray(S_VVt,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4466,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4467 PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&B_N,&one,x,&B_one,y,&B_one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASaxpy"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 4467; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
daxpy_(&B_N,&one,x,&B_one,y,&B_one); do { do
{PetscErrorCode _7_ierr = PetscMallocValidate(4467,__func__,
"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),4467,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
4468 ierr = MatDenseRestoreArray(A_VV,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4468,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4469 ierr = MatDenseRestoreArray(S_VVt,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4469,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4470 ierr = MatCopy(S_VVt,S_VV,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4470,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4471 ierr = MatDestroy(&S_VVt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4471,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4472 } else {
4473 ierr = MatCopy(A_VV,S_VV,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4473,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4474 }
4475 ierr = MatDestroy(&A_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4475,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4476
4477 /* coarse basis functions */
4478 for (i=0;i<n_vertices;i++) {
4479 PetscScalar *y;
4480
4481 ierr = VecPlaceArray(pcbddc->vec1_R,work+lda_rhs*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4481,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4482 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4482,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4483 ierr = VecPlaceArray(pcis->vec1_B,y+n_B*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4483,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4484 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4484,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4485 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4486 y[n_B*i+idx_V_B[i]] = 1.0;
4487 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4488 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4488,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4489
4490 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4491 PetscInt j;
4492
4493 ierr = MatDenseGetArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4494 ierr = VecPlaceArray(pcis->vec1_D,y+n_D*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4495 ierr = VecScatterBegin(pcbddc->R_to_D,pcbddc->vec1_R,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4496 ierr = VecScatterEnd(pcbddc->R_to_D,pcbddc->vec1_R,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4497 ierr = VecResetArray(pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4498 for (j=0;j<pcbddc->benign_n;j++) y[n_D*i+p0_lidx_I[j]] = 0.0;
4499 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4499,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4500 }
4501 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4501,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4502 }
4503 /* if n_R == 0 the object is not destroyed */
4504 ierr = MatDestroy(&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4504,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4505 }
4506 ierr = VecDestroy(&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4506,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4507
4508 if (n_constraints) {
4509 Mat B;
4510
4511 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),lda_rhs,n_constraints,work,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4512 ierr = MatScale(S_CC,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4513 ierr = MatMatMult(local_auxmat2_R,S_CC,MAT_REUSE_MATRIX,PETSC_DEFAULT-2,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4513,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4514 ierr = MatScale(S_CC,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4514,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4515 if (n_vertices) {
4516 if (isCHOL || need_benign_correction) { /* if we can solve the interior problem with cholesky, we should also be fine with transposing here */
4517 ierr = MatTranspose(S_CV,MAT_REUSE_MATRIX,&S_VC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4517,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4518 } else {
4519 Mat S_VCt;
4520
4521 if (lda_rhs != n_R) {
4522 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4523 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_R,n_constraints,work,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4523,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4524 ierr = MatSeqDenseSetLDA(B,lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4524,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4525 }
4526 ierr = MatMatMult(A_VR,B,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&S_VCt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4526,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4527 ierr = MatCopy(S_VCt,S_VC,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4527,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4528 ierr = MatDestroy(&S_VCt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4528,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4529 }
4530 }
4531 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4532 /* coarse basis functions */
4533 for (i=0;i<n_constraints;i++) {
4534 PetscScalar *y;
4535
4536 ierr = VecPlaceArray(pcbddc->vec1_R,work+lda_rhs*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4537 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4537,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4538 ierr = VecPlaceArray(pcis->vec1_B,y+n_B*(i+n_vertices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4538,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4539 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4539,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4540 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4540,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4541 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4542 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4542,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4543 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4544 PetscInt j;
4545
4546 ierr = MatDenseGetArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4546,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4547 ierr = VecPlaceArray(pcis->vec1_D,y+n_D*(i+n_vertices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4547,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4548 ierr = VecScatterBegin(pcbddc->R_to_D,pcbddc->vec1_R,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4548,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4549 ierr = VecScatterEnd(pcbddc->R_to_D,pcbddc->vec1_R,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4549,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4550 ierr = VecResetArray(pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4550,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4551 for (j=0;j<pcbddc->benign_n;j++) y[n_D*i+p0_lidx_I[j]] = 0.0;
4552 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4553 }
4554 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4555 }
4556 }
4557 if (n_constraints) {
4558 ierr = MatDestroy(&local_auxmat2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4558,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4559 }
4560 ierr = PetscFree(p0_lidx_I)((*PetscTrFree)((void*)(p0_lidx_I),4560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((p0_lidx_I) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4561
4562 /* coarse matrix entries relative to B_0 */
4563 if (pcbddc->benign_n) {
4564 Mat B0_B,B0_BPHI;
4565 IS is_dummy;
4566 PetscScalar *data;
4567 PetscInt j;
4568
4569 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->benign_n,0,1,&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4570 ierr = MatCreateSubMatrix(pcbddc->benign_B0,is_dummy,pcis->is_B_local,MAT_INITIAL_MATRIX,&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4570,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4571 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4571,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4572 ierr = MatMatMult(B0_B,pcbddc->coarse_phi_B,MAT_INITIAL_MATRIX,1.0,&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4572,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4573 ierr = MatConvert(B0_BPHI,MATSEQDENSE"seqdense",MAT_INPLACE_MATRIX,&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4574 ierr = MatDenseGetArray(B0_BPHI,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4574,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4575 for (j=0;j<pcbddc->benign_n;j++) {
4576 PetscInt primal_idx = pcbddc->local_primal_size - pcbddc->benign_n + j;
4577 for (i=0;i<pcbddc->local_primal_size;i++) {
4578 coarse_submat_vals[primal_idx*pcbddc->local_primal_size+i] = data[i*pcbddc->benign_n+j];
4579 coarse_submat_vals[i*pcbddc->local_primal_size+primal_idx] = data[i*pcbddc->benign_n+j];
4580 }
4581 }
4582 ierr = MatDenseRestoreArray(B0_BPHI,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4582,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4583 ierr = MatDestroy(&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4584 ierr = MatDestroy(&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4584,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4585 }
4586
4587 /* compute other basis functions for non-symmetric problems */
4588 if (!pcbddc->symmetric_primal) {
4589 Mat B_V=NULL((void*)0),B_C=NULL((void*)0);
4590 PetscScalar *marray;
4591
4592 if (n_constraints) {
4593 Mat S_CCT,C_CRT;
4594
4595 ierr = MatTranspose(C_CR,MAT_INITIAL_MATRIX,&C_CRT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4595,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4596 ierr = MatTranspose(S_CC,MAT_INITIAL_MATRIX,&S_CCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4596,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4597 ierr = MatMatMult(C_CRT,S_CCT,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&B_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4597,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4598 ierr = MatDestroy(&S_CCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4598,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4599 if (n_vertices) {
4600 Mat S_VCT;
4601
4602 ierr = MatTranspose(S_VC,MAT_INITIAL_MATRIX,&S_VCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4602,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4603 ierr = MatMatMult(C_CRT,S_VCT,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&B_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4603,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4604 ierr = MatDestroy(&S_VCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4604,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4605 }
4606 ierr = MatDestroy(&C_CRT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4606,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4607 } else {
4608 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_R,n_vertices,NULL((void*)0),&B_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4608,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4609 }
4610 if (n_vertices && n_R) {
4611 PetscScalar *av,*marray;
4612 const PetscInt *xadj,*adjncy;
4613 PetscInt n;
4614 PetscBool flg_row;
4615
4616 /* B_V = B_V - A_VR^T */
4617 ierr = MatConvert(A_VR,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4617,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4618 ierr = MatGetRowIJ(A_VR,0,PETSC_FALSE,PETSC_FALSE,&n,&xadj,&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4619 ierr = MatSeqAIJGetArray(A_VR,&av);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4619,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4620 ierr = MatDenseGetArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4621 for (i=0;i<n;i++) {
4622 PetscInt j;
4623 for (j=xadj[i];j<xadj[i+1];j++) marray[i*n_R + adjncy[j]] -= av[j];
4624 }
4625 ierr = MatDenseRestoreArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4625,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4626 ierr = MatRestoreRowIJ(A_VR,0,PETSC_FALSE,PETSC_FALSE,&n,&xadj,&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4626,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4627 ierr = MatDestroy(&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4627,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4628 }
4629
4630 /* currently there's no support for MatTransposeMatSolve(F,B,X) */
4631 if (n_vertices) {
4632 ierr = MatDenseGetArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4632,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4633 for (i=0;i<n_vertices;i++) {
4634 ierr = VecPlaceArray(pcbddc->vec1_R,marray+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4634,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4635 ierr = VecPlaceArray(pcbddc->vec2_R,work+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4636 ierr = KSPSolveTranspose(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4637 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4637,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4638 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4638,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4639 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4640 }
4641 ierr = MatDenseRestoreArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4641,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4642 }
4643 if (B_C) {
4644 ierr = MatDenseGetArray(B_C,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4645 for (i=n_vertices;i<n_constraints+n_vertices;i++) {
4646 ierr = VecPlaceArray(pcbddc->vec1_R,marray+(i-n_vertices)*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4647 ierr = VecPlaceArray(pcbddc->vec2_R,work+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4648 ierr = KSPSolveTranspose(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4648,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4649 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4650 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4651 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4652 }
4653 ierr = MatDenseRestoreArray(B_C,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4653,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4654 }
4655 /* coarse basis functions */
4656 for (i=0;i<pcbddc->local_primal_size;i++) {
4657 PetscScalar *y;
4658
4659 ierr = VecPlaceArray(pcbddc->vec1_R,work+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4659,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4660 ierr = MatDenseGetArray(pcbddc->coarse_psi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4660,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4661 ierr = VecPlaceArray(pcis->vec1_B,y+n_B*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4661,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4662 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4662,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4663 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4663,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4664 if (i<n_vertices) {
4665 y[n_B*i+idx_V_B[i]] = 1.0;
4666 }
4667 ierr = MatDenseRestoreArray(pcbddc->coarse_psi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4667,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4668 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4668,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4669
4670 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4671 ierr = MatDenseGetArray(pcbddc->coarse_psi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4671,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4672 ierr = VecPlaceArray(pcis->vec1_D,y+n_D*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4672,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4673 ierr = VecScatterBegin(pcbddc->R_to_D,pcbddc->vec1_R,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4674 ierr = VecScatterEnd(pcbddc->R_to_D,pcbddc->vec1_R,pcis->vec1_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4675 ierr = VecResetArray(pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4675,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4676 ierr = MatDenseRestoreArray(pcbddc->coarse_psi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4677 }
4678 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4679 }
4680 ierr = MatDestroy(&B_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4680,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4681 ierr = MatDestroy(&B_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4682 }
4683
4684 /* free memory */
4685 ierr = PetscFree(idx_V_B)((*PetscTrFree)((void*)(idx_V_B),4685,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((idx_V_B) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4685,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4686 ierr = MatDestroy(&S_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4686,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4687 ierr = MatDestroy(&S_CV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4687,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4688 ierr = MatDestroy(&S_VC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4689 ierr = MatDestroy(&S_CC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4689,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4690 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),4690,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4690,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4691 if (n_vertices) {
4692 ierr = MatDestroy(&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4693 }
4694 if (n_constraints) {
4695 ierr = MatDestroy(&C_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4696 }
4697 /* Checking coarse_sub_mat and coarse basis functios */
4698 /* Symmetric case : It should be \Phi^{(j)^T} A^{(j)} \Phi^{(j)}=coarse_sub_mat */
4699 /* Non-symmetric case : It should be \Psi^{(j)^T} A^{(j)} \Phi^{(j)}=coarse_sub_mat */
4700 if (pcbddc->dbg_flag) {
4701 Mat coarse_sub_mat;
4702 Mat AUXMAT,TM1,TM2,TM3,TM4;
4703 Mat coarse_phi_D,coarse_phi_B;
4704 Mat coarse_psi_D,coarse_psi_B;
4705 Mat A_II,A_BB,A_IB,A_BI;
4706 Mat C_B,CPHI;
4707 IS is_dummy;
4708 Vec mones;
4709 MatType checkmattype=MATSEQAIJ"seqaij";
4710 PetscReal real_value;
4711
4712 if (pcbddc->benign_n && !pcbddc->benign_change_explicit) {
4713 Mat A;
4714 ierr = PCBDDCBenignProject(pc,NULL((void*)0),NULL((void*)0),&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4715 ierr = MatCreateSubMatrix(A,pcis->is_I_local,pcis->is_I_local,MAT_INITIAL_MATRIX,&A_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4716 ierr = MatCreateSubMatrix(A,pcis->is_I_local,pcis->is_B_local,MAT_INITIAL_MATRIX,&A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4716,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4717 ierr = MatCreateSubMatrix(A,pcis->is_B_local,pcis->is_I_local,MAT_INITIAL_MATRIX,&A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4718 ierr = MatCreateSubMatrix(A,pcis->is_B_local,pcis->is_B_local,MAT_INITIAL_MATRIX,&A_BB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4719 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4719,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4720 } else {
4721 ierr = MatConvert(pcis->A_II,checkmattype,MAT_INITIAL_MATRIX,&A_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4721,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4722 ierr = MatConvert(pcis->A_IB,checkmattype,MAT_INITIAL_MATRIX,&A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4722,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4723 ierr = MatConvert(pcis->A_BI,checkmattype,MAT_INITIAL_MATRIX,&A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4723,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4724 ierr = MatConvert(pcis->A_BB,checkmattype,MAT_INITIAL_MATRIX,&A_BB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4724,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4725 }
4726 ierr = MatConvert(pcbddc->coarse_phi_D,checkmattype,MAT_INITIAL_MATRIX,&coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4726,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4727 ierr = MatConvert(pcbddc->coarse_phi_B,checkmattype,MAT_INITIAL_MATRIX,&coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4727,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4728 if (!pcbddc->symmetric_primal) {
4729 ierr = MatConvert(pcbddc->coarse_psi_D,checkmattype,MAT_INITIAL_MATRIX,&coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4729,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4730 ierr = MatConvert(pcbddc->coarse_psi_B,checkmattype,MAT_INITIAL_MATRIX,&coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4730,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4731 }
4732 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->local_primal_size,pcbddc->local_primal_size,coarse_submat_vals,&coarse_sub_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4732,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4733
4734 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4735 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Check coarse sub mat computation (symmetric %d)\n",pcbddc->symmetric_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4735,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4736 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4736,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4737 if (!pcbddc->symmetric_primal) {
4738 ierr = MatMatMult(A_II,coarse_phi_D,MAT_INITIAL_MATRIX,1.0,&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4738,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4739 ierr = MatTransposeMatMult(coarse_psi_D,AUXMAT,MAT_INITIAL_MATRIX,1.0,&TM1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4740 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4740,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4741 ierr = MatMatMult(A_BB,coarse_phi_B,MAT_INITIAL_MATRIX,1.0,&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4741,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4742 ierr = MatTransposeMatMult(coarse_psi_B,AUXMAT,MAT_INITIAL_MATRIX,1.0,&TM2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4742,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4743 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4743,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4744 ierr = MatMatMult(A_IB,coarse_phi_B,MAT_INITIAL_MATRIX,1.0,&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4744,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4745 ierr = MatTransposeMatMult(coarse_psi_D,AUXMAT,MAT_INITIAL_MATRIX,1.0,&TM3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4745,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4746 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4747 ierr = MatMatMult(A_BI,coarse_phi_D,MAT_INITIAL_MATRIX,1.0,&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4748 ierr = MatTransposeMatMult(coarse_psi_B,AUXMAT,MAT_INITIAL_MATRIX,1.0,&TM4);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4749 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4750 } else {
4751 ierr = MatPtAP(A_II,coarse_phi_D,MAT_INITIAL_MATRIX,1.0,&TM1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4751,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4752 ierr = MatPtAP(A_BB,coarse_phi_B,MAT_INITIAL_MATRIX,1.0,&TM2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4753 ierr = MatMatMult(A_IB,coarse_phi_B,MAT_INITIAL_MATRIX,1.0,&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4753,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4754 ierr = MatTransposeMatMult(coarse_phi_D,AUXMAT,MAT_INITIAL_MATRIX,1.0,&TM3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4754,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4755 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4755,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4756 ierr = MatMatMult(A_BI,coarse_phi_D,MAT_INITIAL_MATRIX,1.0,&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4756,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4757 ierr = MatTransposeMatMult(coarse_phi_B,AUXMAT,MAT_INITIAL_MATRIX,1.0,&TM4);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4757,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4758 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4758,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4759 }
4760 ierr = MatAXPY(TM1,one,TM2,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4760,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4761 ierr = MatAXPY(TM1,one,TM3,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4761,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4762 ierr = MatAXPY(TM1,one,TM4,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4762,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4763 ierr = MatConvert(TM1,MATSEQDENSE"seqdense",MAT_INPLACE_MATRIX,&TM1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4764 if (pcbddc->benign_n) {
4765 Mat B0_B,B0_BPHI;
4766 PetscScalar *data,*data2;
4767 PetscInt j;
4768
4769 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->benign_n,0,1,&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4769,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4770 ierr = MatCreateSubMatrix(pcbddc->benign_B0,is_dummy,pcis->is_B_local,MAT_INITIAL_MATRIX,&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4770,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4771 ierr = MatMatMult(B0_B,coarse_phi_B,MAT_INITIAL_MATRIX,1.0,&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4771,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4772 ierr = MatConvert(B0_BPHI,MATSEQDENSE"seqdense",MAT_INPLACE_MATRIX,&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4773 ierr = MatDenseGetArray(TM1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4774 ierr = MatDenseGetArray(B0_BPHI,&data2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4774,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4775 for (j=0;j<pcbddc->benign_n;j++) {
4776 PetscInt primal_idx = pcbddc->local_primal_size - pcbddc->benign_n + j;
4777 for (i=0;i<pcbddc->local_primal_size;i++) {
4778 data[primal_idx*pcbddc->local_primal_size+i] += data2[i*pcbddc->benign_n+j];
4779 data[i*pcbddc->local_primal_size+primal_idx] += data2[i*pcbddc->benign_n+j];
4780 }
4781 }
4782 ierr = MatDenseRestoreArray(TM1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4782,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4783 ierr = MatDenseRestoreArray(B0_BPHI,&data2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4783,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4784 ierr = MatDestroy(&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4784,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4785 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4785,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4786 ierr = MatDestroy(&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4786,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4787 }
4788#if 0
4789 {
4790 PetscViewer viewer;
4791 char filename[256];
4792 sprintf(filename,"details_local_coarse_mat%d_level%d.m",PetscGlobalRank,pcbddc->current_level);
4793 ierr = PetscViewerASCIIOpen(PETSC_COMM_SELF((MPI_Comm)0x44000001),filename,&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4794 ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4795 ierr = PetscObjectSetName((PetscObject)coarse_sub_mat,"computed");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4796 ierr = MatView(coarse_sub_mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4796,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4797 ierr = PetscObjectSetName((PetscObject)TM1,"projected");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4797,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4798 ierr = MatView(TM1,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4798,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4799 if (pcbddc->coarse_phi_B) {
4800 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_phi_B,"phi_B");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4800,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4801 ierr = MatView(pcbddc->coarse_phi_B,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4802 }
4803 if (pcbddc->coarse_phi_D) {
4804 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_phi_D,"phi_D");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4804,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4805 ierr = MatView(pcbddc->coarse_phi_D,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4806 }
4807 if (pcbddc->coarse_psi_B) {
4808 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_psi_B,"psi_B");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4809 ierr = MatView(pcbddc->coarse_psi_B,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4809,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4810 }
4811 if (pcbddc->coarse_psi_D) {
4812 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_psi_D,"psi_D");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4813 ierr = MatView(pcbddc->coarse_psi_D,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4813,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4814 }
4815 ierr = PetscObjectSetName((PetscObject)pcbddc->local_mat,"A");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4815,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4816 ierr = MatView(pcbddc->local_mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4816,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4817 ierr = PetscObjectSetName((PetscObject)pcbddc->ConstraintMatrix,"C");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4818 ierr = MatView(pcbddc->ConstraintMatrix,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4819 ierr = PetscObjectSetName((PetscObject)pcis->is_I_local,"I");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4820 ierr = ISView(pcis->is_I_local,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4821 ierr = PetscObjectSetName((PetscObject)pcis->is_B_local,"B");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4822 ierr = ISView(pcis->is_B_local,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4822,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4823 ierr = PetscObjectSetName((PetscObject)pcbddc->is_R_local,"R");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4824 ierr = ISView(pcbddc->is_R_local,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4825 ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4826 }
4827#endif
4828 ierr = MatAXPY(TM1,m_one,coarse_sub_mat,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4828,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4829 ierr = MatNorm(TM1,NORM_FROBENIUS,&real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4829,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4830 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4830,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4831 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d matrix error % 1.14e\n",PetscGlobalRank,real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4831,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4832
4833 /* check constraints */
4834 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->local_primal_size-pcbddc->benign_n,0,1,&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4835 ierr = MatCreateSubMatrix(pcbddc->ConstraintMatrix,is_dummy,pcis->is_B_local,MAT_INITIAL_MATRIX,&C_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4836 if (!pcbddc->benign_n) { /* TODO: add benign case */
4837 ierr = MatMatMult(C_B,coarse_phi_B,MAT_INITIAL_MATRIX,1.0,&CPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4837,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4838 } else {
4839 PetscScalar *data;
4840 Mat tmat;
4841 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4841,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4842 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcis->n_B,pcbddc->local_primal_size-pcbddc->benign_n,data,&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4842,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4843 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4843,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4844 ierr = MatMatMult(C_B,tmat,MAT_INITIAL_MATRIX,1.0,&CPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4844,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4845 ierr = MatDestroy(&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4845,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4846 }
4847 ierr = MatCreateVecs(CPHI,&mones,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4847,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4848 ierr = VecSet(mones,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4848,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4849 ierr = MatDiagonalSet(CPHI,mones,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4849,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4850 ierr = MatNorm(CPHI,NORM_FROBENIUS,&real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4850,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4851 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d phi constraints error % 1.14e\n",PetscGlobalRank,real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4851,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4852 if (!pcbddc->symmetric_primal) {
4853 ierr = MatMatMult(C_B,coarse_psi_B,MAT_REUSE_MATRIX,1.0,&CPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4853,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4854 ierr = VecSet(mones,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4854,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4855 ierr = MatDiagonalSet(CPHI,mones,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4855,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4856 ierr = MatNorm(CPHI,NORM_FROBENIUS,&real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4857 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d psi constraints error % 1.14e\n",PetscGlobalRank,real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4857,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4858 }
4859 ierr = MatDestroy(&C_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4860 ierr = MatDestroy(&CPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4861 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4862 ierr = VecDestroy(&mones);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4862,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4863 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4863,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4864 ierr = MatDestroy(&A_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4864,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4865 ierr = MatDestroy(&A_BB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4866 ierr = MatDestroy(&A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4867 ierr = MatDestroy(&A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4868 ierr = MatDestroy(&TM1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4869 ierr = MatDestroy(&TM2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4870 ierr = MatDestroy(&TM3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4870,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4871 ierr = MatDestroy(&TM4);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4871,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4872 ierr = MatDestroy(&coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4872,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4873 ierr = MatDestroy(&coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4874 if (!pcbddc->symmetric_primal) {
4875 ierr = MatDestroy(&coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4876 ierr = MatDestroy(&coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4876,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4877 }
4878 ierr = MatDestroy(&coarse_sub_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4878,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4879 }
4880 /* get back data */
4881 *coarse_submat_vals_n = coarse_submat_vals;
4882 ierr = PetscLogEventEnd(PC_BDDC_CorrectionSetUp[pcbddc->current_level],pc,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_CorrectionSetUp[pcbddc->current_level]].active) ?
(*PetscLogPLE)((PC_BDDC_CorrectionSetUp[pcbddc->current_level
]),0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4882,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4883 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4884}
4885
4886PetscErrorCode MatCreateSubMatrixUnsorted(Mat A, IS isrow, IS iscol, Mat* B)
4887{
4888 Mat *work_mat;
4889 IS isrow_s,iscol_s;
4890 PetscBool rsorted,csorted;
4891 PetscInt rsize,*idxs_perm_r=NULL((void*)0),csize,*idxs_perm_c=NULL((void*)0);
4892 PetscErrorCode ierr;
4893
4894 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 4894; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4895 ierr = ISSorted(isrow,&rsorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4895,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4896 ierr = ISSorted(iscol,&csorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4897 ierr = ISGetLocalSize(isrow,&rsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4898 ierr = ISGetLocalSize(iscol,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4898,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4899
4900 if (!rsorted) {
4901 const PetscInt *idxs;
4902 PetscInt *idxs_sorted,i;
4903
4904 ierr = PetscMalloc1(rsize,&idxs_perm_r)PetscMallocA(1,PETSC_FALSE,4904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(rsize)*sizeof(**(&idxs_perm_r)),(&idxs_perm_r
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4905 ierr = PetscMalloc1(rsize,&idxs_sorted)PetscMallocA(1,PETSC_FALSE,4905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(rsize)*sizeof(**(&idxs_sorted)),(&idxs_sorted
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4906 for (i=0;i<rsize;i++) {
4907 idxs_perm_r[i] = i;
4908 }
4909 ierr = ISGetIndices(isrow,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4910 ierr = PetscSortIntWithPermutation(rsize,idxs,idxs_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4910,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4911 for (i=0;i<rsize;i++) {
4912 idxs_sorted[i] = idxs[idxs_perm_r[i]];
4913 }
4914 ierr = ISRestoreIndices(isrow,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4915 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),rsize,idxs_sorted,PETSC_OWN_POINTER,&isrow_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4915,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4916 } else {
4917 ierr = PetscObjectReference((PetscObject)isrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4918 isrow_s = isrow;
4919 }
4920
4921 if (!csorted) {
4922 if (isrow == iscol) {
4923 ierr = PetscObjectReference((PetscObject)isrow_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4923,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4924 iscol_s = isrow_s;
4925 } else {
4926 const PetscInt *idxs;
4927 PetscInt *idxs_sorted,i;
4928
4929 ierr = PetscMalloc1(csize,&idxs_perm_c)PetscMallocA(1,PETSC_FALSE,4929,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(csize)*sizeof(**(&idxs_perm_c)),(&idxs_perm_c
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4929,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4930 ierr = PetscMalloc1(csize,&idxs_sorted)PetscMallocA(1,PETSC_FALSE,4930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(csize)*sizeof(**(&idxs_sorted)),(&idxs_sorted
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4931 for (i=0;i<csize;i++) {
4932 idxs_perm_c[i] = i;
4933 }
4934 ierr = ISGetIndices(iscol,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4935 ierr = PetscSortIntWithPermutation(csize,idxs,idxs_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4935,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4936 for (i=0;i<csize;i++) {
4937 idxs_sorted[i] = idxs[idxs_perm_c[i]];
4938 }
4939 ierr = ISRestoreIndices(iscol,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4940 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),csize,idxs_sorted,PETSC_OWN_POINTER,&iscol_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4940,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4941 }
4942 } else {
4943 ierr = PetscObjectReference((PetscObject)iscol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4944 iscol_s = iscol;
4945 }
4946
4947 ierr = MatCreateSubMatrices(A,1,&isrow_s,&iscol_s,MAT_INITIAL_MATRIX,&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4947,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4948
4949 if (!rsorted || !csorted) {
4950 Mat new_mat;
4951 IS is_perm_r,is_perm_c;
4952
4953 if (!rsorted) {
4954 PetscInt *idxs_r,i;
4955 ierr = PetscMalloc1(rsize,&idxs_r)PetscMallocA(1,PETSC_FALSE,4955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(rsize)*sizeof(**(&idxs_r)),(&idxs_r))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4955,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4956 for (i=0;i<rsize;i++) {
4957 idxs_r[idxs_perm_r[i]] = i;
4958 }
4959 ierr = PetscFree(idxs_perm_r)((*PetscTrFree)((void*)(idxs_perm_r),4959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((idxs_perm_r) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4960 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),rsize,idxs_r,PETSC_OWN_POINTER,&is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4960,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4961 } else {
4962 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),rsize,0,1,&is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4962,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4963 }
4964 ierr = ISSetPermutation(is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4964,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4965
4966 if (!csorted) {
4967 if (isrow_s == iscol_s) {
4968 ierr = PetscObjectReference((PetscObject)is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4968,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4969 is_perm_c = is_perm_r;
4970 } else {
4971 PetscInt *idxs_c,i;
4972 if (!idxs_perm_c) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Permutation array not present")return PetscError(((MPI_Comm)0x44000001),4972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Permutation array not present")
;
4973 ierr = PetscMalloc1(csize,&idxs_c)PetscMallocA(1,PETSC_FALSE,4973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(csize)*sizeof(**(&idxs_c)),(&idxs_c))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4974 for (i=0;i<csize;i++) {
4975 idxs_c[idxs_perm_c[i]] = i;
4976 }
4977 ierr = PetscFree(idxs_perm_c)((*PetscTrFree)((void*)(idxs_perm_c),4977,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((idxs_perm_c) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4977,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4978 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),csize,idxs_c,PETSC_OWN_POINTER,&is_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4979 }
4980 } else {
4981 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),csize,0,1,&is_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4982 }
4983 ierr = ISSetPermutation(is_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4983,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4984
4985 ierr = MatPermute(work_mat[0],is_perm_r,is_perm_c,&new_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4985,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4986 ierr = MatDestroy(&work_mat[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4987 work_mat[0] = new_mat;
4988 ierr = ISDestroy(&is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4988,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4989 ierr = ISDestroy(&is_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4989,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4990 }
4991
4992 ierr = PetscObjectReference((PetscObject)work_mat[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4992,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4993 *B = work_mat[0];
4994 ierr = MatDestroyMatrices(1,&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4994,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4995 ierr = ISDestroy(&isrow_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4995,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4996 ierr = ISDestroy(&iscol_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4996,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4997 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4998}
4999
5000PetscErrorCode PCBDDCComputeLocalMatrix(PC pc, Mat ChangeOfBasisMatrix)
5001{
5002 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
5003 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
5004 Mat new_mat,lA;
5005 IS is_local,is_global;
5006 PetscInt local_size;
5007 PetscBool isseqaij;
5008 PetscErrorCode ierr;
5009
5010 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5010; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5011 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5011,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5012 ierr = MatGetSize(matis->A,&local_size,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5012,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5013 ierr = ISCreateStride(PetscObjectComm((PetscObject)matis->A),local_size,0,1,&is_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5013,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5014 ierr = ISLocalToGlobalMappingApplyIS(pc->pmat->rmap->mapping,is_local,&is_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5014,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5015 ierr = ISDestroy(&is_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5015,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5016 ierr = MatCreateSubMatrixUnsorted(ChangeOfBasisMatrix,is_global,is_global,&new_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5016,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5017 ierr = ISDestroy(&is_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5017,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5018
5019 /* check */
5020 if (pcbddc->dbg_flag) {
5021 Vec x,x_change;
5022 PetscReal error;
5023
5024 ierr = MatCreateVecs(ChangeOfBasisMatrix,&x,&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5024,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5025 ierr = VecSetRandom(x,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5025,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5026 ierr = MatMult(ChangeOfBasisMatrix,x,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5026,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5027 ierr = VecScatterBegin(matis->cctx,x,matis->x,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5027,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5028 ierr = VecScatterEnd(matis->cctx,x,matis->x,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5028,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5029 ierr = MatMult(new_mat,matis->x,matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5030 if (!pcbddc->change_interior) {
5031 const PetscScalar *x,*y,*v;
5032 PetscReal lerror = 0.;
5033 PetscInt i;
5034
5035 ierr = VecGetArrayRead(matis->x,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5035,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5036 ierr = VecGetArrayRead(matis->y,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5036,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5037 ierr = VecGetArrayRead(matis->counter,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5037,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5038 for (i=0;i<local_size;i++)
5039 if (PetscRealPart(v[i])(v[i]) < 1.5 && PetscAbsScalar(x[i]-y[i]) > lerror)
5040 lerror = PetscAbsScalar(x[i]-y[i]);
5041 ierr = VecRestoreArrayRead(matis->x,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5041,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5042 ierr = VecRestoreArrayRead(matis->y,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5042,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5043 ierr = VecRestoreArrayRead(matis->counter,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5043,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5044 ierr = MPIU_Allreduce(&lerror,&error,1,MPIU_REAL,MPI_MAX,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,5044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&lerror),(&error
),(1),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000001)),(PetscObjectComm
((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5045 if (error > PETSC_SMALL1.e-10) {
5046 if (!pcbddc->user_ChangeOfBasisMatrix || pcbddc->current_level) {
5047 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"Error global vs local change on I: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5047,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error global vs local change on I: %1.6e"
,error)
;
5048 } else {
5049 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_USER,"Error global vs local change on I: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5049,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Error global vs local change on I: %1.6e"
,error)
;
5050 }
5051 }
5052 }
5053 ierr = VecScatterBegin(matis->rctx,matis->y,x,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5054 ierr = VecScatterEnd(matis->rctx,matis->y,x,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5054,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5055 ierr = VecAXPY(x,-1.0,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5055,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5056 ierr = VecNorm(x,NORM_INFINITY,&error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5057 if (error > PETSC_SMALL1.e-10) {
5058 if (!pcbddc->user_ChangeOfBasisMatrix || pcbddc->current_level) {
5059 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"Error global vs local change on N: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5059,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error global vs local change on N: %1.6e"
,error)
;
5060 } else {
5061 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_USER,"Error global vs local change on N: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5061,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Error global vs local change on N: %1.6e"
,error)
;
5062 }
5063 }
5064 ierr = VecDestroy(&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5065 ierr = VecDestroy(&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5066 }
5067
5068 /* lA is present if we are setting up an inner BDDC for a saddle point FETI-DP */
5069 ierr = PetscObjectQuery((PetscObject)pc,"__KSPFETIDP_lA" ,(PetscObject*)&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5070
5071 /* TODO: HOW TO WORK WITH BAIJ and SBAIJ and SEQDENSE? */
5072 ierr = PetscObjectTypeCompare((PetscObject)matis->A,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5073 if (isseqaij) {
5074 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5074,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5075 ierr = MatPtAP(matis->A,new_mat,MAT_INITIAL_MATRIX,2.0,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5075,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5076 if (lA) {
5077 Mat work;
5078 ierr = MatPtAP(lA,new_mat,MAT_INITIAL_MATRIX,2.0,&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5079 ierr = PetscObjectCompose((PetscObject)pc,"__KSPFETIDP_lA" ,(PetscObject)work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5079,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5080 ierr = MatDestroy(&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5081 }
5082 } else {
5083 Mat work_mat;
5084
5085 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5085,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5086 ierr = MatConvert(matis->A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5086,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5087 ierr = MatPtAP(work_mat,new_mat,MAT_INITIAL_MATRIX,2.0,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5087,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5088 ierr = MatDestroy(&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5088,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5089 if (lA) {
5090 Mat work;
5091 ierr = MatConvert(lA,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5091,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5092 ierr = MatPtAP(work_mat,new_mat,MAT_INITIAL_MATRIX,2.0,&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5092,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5093 ierr = PetscObjectCompose((PetscObject)pc,"__KSPFETIDP_lA" ,(PetscObject)work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5094 ierr = MatDestroy(&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5094,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5095 }
5096 }
5097 if (matis->A->symmetric_set) {
5098 ierr = MatSetOption(pcbddc->local_mat,MAT_SYMMETRIC,matis->A->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5098,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5099#if !defined(PETSC_USE_COMPLEX)
5100 ierr = MatSetOption(pcbddc->local_mat,MAT_HERMITIAN,matis->A->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5100,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5101#endif
5102 }
5103 ierr = MatDestroy(&new_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5104 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5105}
5106
5107PetscErrorCode PCBDDCSetUpLocalScatters(PC pc)
5108{
5109 PC_IS* pcis = (PC_IS*)(pc->data);
5110 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
5111 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5112 PetscInt *idx_R_local=NULL((void*)0);
5113 PetscInt n_vertices,i,j,n_R,n_D,n_B;
5114 PetscInt vbs,bs;
5115 PetscBT bitmask=NULL((void*)0);
5116 PetscErrorCode ierr;
5117
5118 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5118; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5119 /*
5120 No need to setup local scatters if
5121 - primal space is unchanged
5122 AND
5123 - we actually have locally some primal dofs (could not be true in multilevel or for isolated subdomains)
5124 AND
5125 - we are not in debugging mode (this is needed since there are Synchronized prints at the end of the subroutine
5126 */
5127 if (!pcbddc->new_primal_space_local && pcbddc->local_primal_size && !pcbddc->dbg_flag) {
5128 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5129 }
5130 /* destroy old objects */
5131 ierr = ISDestroy(&pcbddc->is_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5132 ierr = VecScatterDestroy(&pcbddc->R_to_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5133 ierr = VecScatterDestroy(&pcbddc->R_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5134 /* Set Non-overlapping dimensions */
5135 n_B = pcis->n_B;
5136 n_D = pcis->n - n_B;
5137 n_vertices = pcbddc->n_vertices;
5138
5139 /* Dohrmann's notation: dofs splitted in R (Remaining: all dofs but the vertices) and V (Vertices) */
5140
5141 /* create auxiliary bitmask and allocate workspace */
5142 if (!sub_schurs || !sub_schurs->reuse_solver) {
5143 ierr = PetscMalloc1(pcis->n-n_vertices,&idx_R_local)PetscMallocA(1,PETSC_FALSE,5143,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n-n_vertices)*sizeof(**(&idx_R_local))
,(&idx_R_local))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5143,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5144 ierr = PetscBTCreate(pcis->n,&bitmask);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5144,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5145 for (i=0;i<n_vertices;i++) {
5146 ierr = PetscBTSet(bitmask,pcbddc->local_primal_ref_node[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5146,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5147 }
5148
5149 for (i=0, n_R=0; i<pcis->n; i++) {
5150 if (!PetscBTLookup(bitmask,i)) {
5151 idx_R_local[n_R++] = i;
5152 }
5153 }
5154 } else { /* A different ordering (already computed) is present if we are reusing the Schur solver */
5155 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5156
5157 ierr = ISGetIndices(reuse_solver->is_R,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5157,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5158 ierr = ISGetLocalSize(reuse_solver->is_R,&n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5158,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5159 }
5160
5161 /* Block code */
5162 vbs = 1;
5163 ierr = MatGetBlockSize(pcbddc->local_mat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5164 if (bs>1 && !(n_vertices%bs)) {
5165 PetscBool is_blocked = PETSC_TRUE;
5166 PetscInt *vary;
5167 if (!sub_schurs || !sub_schurs->reuse_solver) {
5168 ierr = PetscMalloc1(pcis->n/bs,&vary)PetscMallocA(1,PETSC_FALSE,5168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n/bs)*sizeof(**(&vary)),(&vary))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5169 ierr = PetscMemzero(vary,pcis->n/bs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5169,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5170 /* Verify that the vertex indices correspond to each element in a block (code taken from sbaij2.c) */
5171 /* it is ok to check this way since local_primal_ref_node are always sorted by local numbering and idx_R_local is obtained as a complement */
5172 for (i=0; i<n_vertices; i++) vary[pcbddc->local_primal_ref_node[i]/bs]++;
5173 for (i=0; i<pcis->n/bs; i++) {
5174 if (vary[i]!=0 && vary[i]!=bs) {
5175 is_blocked = PETSC_FALSE;
5176 break;
5177 }
5178 }
5179 ierr = PetscFree(vary)((*PetscTrFree)((void*)(vary),5179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vary) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5180 } else {
5181 /* Verify directly the R set */
5182 for (i=0; i<n_R/bs; i++) {
5183 PetscInt j,node=idx_R_local[bs*i];
5184 for (j=1; j<bs; j++) {
5185 if (node != idx_R_local[bs*i+j]-j) {
5186 is_blocked = PETSC_FALSE;
5187 break;
5188 }
5189 }
5190 }
5191 }
5192 if (is_blocked) { /* build compressed IS for R nodes (complement of vertices) */
5193 vbs = bs;
5194 for (i=0;i<n_R/vbs;i++) {
5195 idx_R_local[i] = idx_R_local[vbs*i]/vbs;
5196 }
5197 }
5198 }
5199 ierr = ISCreateBlock(PETSC_COMM_SELF((MPI_Comm)0x44000001),vbs,n_R/vbs,idx_R_local,PETSC_COPY_VALUES,&pcbddc->is_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5200 if (sub_schurs && sub_schurs->reuse_solver) {
5201 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5202
5203 ierr = ISRestoreIndices(reuse_solver->is_R,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5203,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5204 ierr = ISDestroy(&reuse_solver->is_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5205 ierr = PetscObjectReference((PetscObject)pcbddc->is_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5206 reuse_solver->is_R = pcbddc->is_R_local;
5207 } else {
5208 ierr = PetscFree(idx_R_local)((*PetscTrFree)((void*)(idx_R_local),5208,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((idx_R_local) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5208,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5209 }
5210
5211 /* print some info if requested */
5212 if (pcbddc->dbg_flag) {
5213 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5214 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5214,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5215 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5215,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5216 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d local dimensions\n",PetscGlobalRank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5216,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5217 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"local_size = %D, dirichlet_size = %D, boundary_size = %D\n",pcis->n,n_D,n_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5218 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"r_size = %D, v_size = %D, constraints = %D, local_primal_size = %D\n",n_R,n_vertices,pcbddc->local_primal_size-n_vertices-pcbddc->benign_n,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5218,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5219 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5220 }
5221
5222 /* VecScatters pcbddc->R_to_B and (optionally) pcbddc->R_to_D */
5223 if (!sub_schurs || !sub_schurs->reuse_solver) {
5224 IS is_aux1,is_aux2;
5225 PetscInt *aux_array1,*aux_array2,*is_indices,*idx_R_local;
5226
5227 ierr = ISGetIndices(pcbddc->is_R_local,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5227,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5228 ierr = PetscMalloc1(pcis->n_B-n_vertices,&aux_array1)PetscMallocA(1,PETSC_FALSE,5228,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n_B-n_vertices)*sizeof(**(&aux_array1)
),(&aux_array1))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5228,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5229 ierr = PetscMalloc1(pcis->n_B-n_vertices,&aux_array2)PetscMallocA(1,PETSC_FALSE,5229,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n_B-n_vertices)*sizeof(**(&aux_array2)
),(&aux_array2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5229,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5230 ierr = ISGetIndices(pcis->is_I_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5230,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5231 for (i=0; i<n_D; i++) {
5232 ierr = PetscBTSet(bitmask,is_indices[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5232,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5233 }
5234 ierr = ISRestoreIndices(pcis->is_I_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5234,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5235 for (i=0, j=0; i<n_R; i++) {
5236 if (!PetscBTLookup(bitmask,idx_R_local[i])) {
5237 aux_array1[j++] = i;
5238 }
5239 }
5240 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),j,aux_array1,PETSC_OWN_POINTER,&is_aux1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5240,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5241 ierr = ISGetIndices(pcis->is_B_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5241,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5242 for (i=0, j=0; i<n_B; i++) {
5243 if (!PetscBTLookup(bitmask,is_indices[i])) {
5244 aux_array2[j++] = i;
5245 }
5246 }
5247 ierr = ISRestoreIndices(pcis->is_B_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5248 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),j,aux_array2,PETSC_OWN_POINTER,&is_aux2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5249 ierr = VecScatterCreate(pcbddc->vec1_R,is_aux1,pcis->vec1_B,is_aux2,&pcbddc->R_to_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5250 ierr = ISDestroy(&is_aux1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5251 ierr = ISDestroy(&is_aux2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5252
5253 if (pcbddc->switch_static || pcbddc->dbg_flag) {
5254 ierr = PetscMalloc1(n_D,&aux_array1)PetscMallocA(1,PETSC_FALSE,5254,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_D)*sizeof(**(&aux_array1)),(&aux_array1))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5254,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5255 for (i=0, j=0; i<n_R; i++) {
5256 if (PetscBTLookup(bitmask,idx_R_local[i])) {
5257 aux_array1[j++] = i;
5258 }
5259 }
5260 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),j,aux_array1,PETSC_OWN_POINTER,&is_aux1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5261 ierr = VecScatterCreate(pcbddc->vec1_R,is_aux1,pcis->vec1_D,(IS)0,&pcbddc->R_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5261,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5262 ierr = ISDestroy(&is_aux1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5262,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5263 }
5264 ierr = PetscBTDestroy(&bitmask);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5265 ierr = ISRestoreIndices(pcbddc->is_R_local,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5266 } else {
5267 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5268 IS tis;
5269 PetscInt schur_size;
5270
5271 ierr = ISGetLocalSize(reuse_solver->is_B,&schur_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5271,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5272 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),schur_size,n_D,1,&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5272,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5273 ierr = VecScatterCreate(pcbddc->vec1_R,tis,pcis->vec1_B,reuse_solver->is_B,&pcbddc->R_to_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5274 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5274,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5275 if (pcbddc->switch_static || pcbddc->dbg_flag) {
5276 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),n_D,0,1,&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5276,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5277 ierr = VecScatterCreate(pcbddc->vec1_R,tis,pcis->vec1_D,(IS)0,&pcbddc->R_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5278 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5278,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5279 }
5280 }
5281 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5282}
5283
5284static PetscErrorCode MatNullSpacePropagate_Private(Mat A, IS is, Mat B)
5285{
5286 MatNullSpace NullSpace;
5287 Mat dmat;
5288 const Vec *nullvecs;
5289 Vec v,v2,*nullvecs2;
5290 VecScatter sct;
5291 PetscInt k,nnsp_size,bsiz,n,N,bs;
5292 PetscBool nnsp_has_cnst;
5293 PetscErrorCode ierr;
5294
5295 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5295; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5296 ierr = MatGetNullSpace(B,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5297 if (!NullSpace) {
5298 ierr = MatGetNearNullSpace(B,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5299 }
5300 if (NullSpace) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5301 ierr = MatGetNullSpace(A,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5302 if (!NullSpace) {
5303 ierr = MatGetNearNullSpace(A,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5303,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5304 }
5305 if (!NullSpace) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5306 ierr = MatCreateVecs(A,&v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5307 ierr = MatCreateVecs(B,&v2,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5308 ierr = VecScatterCreate(v,is,v2,NULL((void*)0),&sct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5309 ierr = MatNullSpaceGetVecs(NullSpace,&nnsp_has_cnst,&nnsp_size,(const Vec**)&nullvecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5309,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5310 bsiz = nnsp_size+!!nnsp_has_cnst;
5311 ierr = PetscMalloc1(bsiz,&nullvecs2)PetscMallocA(1,PETSC_FALSE,5311,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(bsiz)*sizeof(**(&nullvecs2)),(&nullvecs2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5311,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5312 ierr = VecGetBlockSize(v2,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5312,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5313 ierr = VecGetSize(v2,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5313,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5314 ierr = VecGetLocalSize(v2,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5314,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5315 ierr = MatCreateDense(PetscObjectComm((PetscObject)B),n,PETSC_DECIDE-1,N,bsiz,NULL((void*)0),&dmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5315,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5316 for (k=0;k<nnsp_size;k++) {
5317 PetscScalar *arr;
5318
5319 ierr = MatDenseGetColumn(dmat,k,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5319,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5320 ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)B),bs,n,N,arr,&nullvecs2[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5320,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5321 ierr = VecScatterBegin(sct,nullvecs[k],nullvecs2[k],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5321,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5322 ierr = VecScatterEnd(sct,nullvecs[k],nullvecs2[k],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5322,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5323 ierr = MatDenseRestoreColumn(dmat,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5323,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5324 }
5325 if (nnsp_has_cnst) {
5326 PetscScalar *arr;
5327
5328 ierr = MatDenseGetColumn(dmat,nnsp_size,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5328,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5329 ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)B),bs,n,N,arr,&nullvecs2[nnsp_size]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5329,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5330 ierr = VecSet(nullvecs2[nnsp_size],1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5330,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5331 ierr = MatDenseRestoreColumn(dmat,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5331,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5332 }
5333 ierr = PCBDDCOrthonormalizeVecs(bsiz,nullvecs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5333,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5334 ierr = MatNullSpaceCreate(PetscObjectComm((PetscObject)B),PETSC_FALSE,bsiz,nullvecs2,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5334,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5335 ierr = PetscObjectCompose((PetscObject)NullSpace,"_PBDDC_Null_dmat",(PetscObject)dmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5335,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5336 ierr = MatDestroy(&dmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5337 for (k=0;k<bsiz;k++) {
5338 ierr = VecDestroy(&nullvecs2[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5338,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5339 }
5340 ierr = PetscFree(nullvecs2)((*PetscTrFree)((void*)(nullvecs2),5340,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nullvecs2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5340,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5341 ierr = MatSetNearNullSpace(B,NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5341,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5342 ierr = MatNullSpaceDestroy(&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5342,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5343 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5343,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5344 ierr = VecDestroy(&v2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5344,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5345 ierr = VecScatterDestroy(&sct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5346 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5347}
5348
5349PetscErrorCode PCBDDCSetUpLocalSolvers(PC pc, PetscBool dirichlet, PetscBool neumann)
5350{
5351 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
5352 PC_IS *pcis = (PC_IS*)pc->data;
5353 PC pc_temp;
5354 Mat A_RR;
5355 MatNullSpace nnsp;
5356 MatReuse reuse;
5357 PetscScalar m_one = -1.0;
5358 PetscReal value;
5359 PetscInt n_D,n_R;
5360 PetscBool issbaij,opts;
5361 PetscErrorCode ierr;
5362 void (*f)(void) = 0;
5363 char dir_prefix[256],neu_prefix[256],str_level[16];
5364 size_t len;
5365
5366 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5366; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5367 ierr = PetscLogEventBegin(PC_BDDC_LocalSolvers[pcbddc->current_level],pc,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_LocalSolvers[pcbddc->current_level]].active) ? (*
PetscLogPLB)((PC_BDDC_LocalSolvers[pcbddc->current_level])
,0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5367,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5368 /* compute prefixes */
5369 ierr = PetscStrcpy(dir_prefix,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5370 ierr = PetscStrcpy(neu_prefix,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5370,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5371 if (!pcbddc->current_level) {
5372 ierr = PetscStrncpy(dir_prefix,((PetscObject)pc)->prefix,sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5372,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5373 ierr = PetscStrncpy(neu_prefix,((PetscObject)pc)->prefix,sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5374 ierr = PetscStrlcat(dir_prefix,"pc_bddc_dirichlet_",sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5374,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5375 ierr = PetscStrlcat(neu_prefix,"pc_bddc_neumann_",sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5376 } else {
5377 ierr = PetscSNPrintf(str_level,sizeof(str_level),"l%d_",(int)(pcbddc->current_level));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5378 ierr = PetscStrlen(((PetscObject)pc)->prefix,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5378,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5379 len -= 15; /* remove "pc_bddc_coarse_" */
5380 if (pcbddc->current_level>1) len -= 3; /* remove "lX_" with X level number */
5381 if (pcbddc->current_level>10) len -= 1; /* remove another char from level number */
5382 /* Nonstandard use of PetscStrncpy() to only copy a portion of the input string */
5383 ierr = PetscStrncpy(dir_prefix,((PetscObject)pc)->prefix,len+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5384 ierr = PetscStrncpy(neu_prefix,((PetscObject)pc)->prefix,len+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5385 ierr = PetscStrlcat(dir_prefix,"pc_bddc_dirichlet_",sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5385,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5386 ierr = PetscStrlcat(neu_prefix,"pc_bddc_neumann_",sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5386,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5387 ierr = PetscStrlcat(dir_prefix,str_level,sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5387,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5388 ierr = PetscStrlcat(neu_prefix,str_level,sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5389 }
5390
5391 /* DIRICHLET PROBLEM */
5392 if (dirichlet) {
5393 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5394 if (pcbddc->benign_n && !pcbddc->benign_change_explicit) {
5395 if (!sub_schurs || !sub_schurs->reuse_solver) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented")return PetscError(((MPI_Comm)0x44000001),5395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
5396 if (pcbddc->dbg_flag) {
5397 Mat A_IIn;
5398
5399 ierr = PCBDDCBenignProject(pc,pcis->is_I_local,pcis->is_I_local,&A_IIn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5399,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5400 ierr = MatDestroy(&pcis->A_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5400,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5401 pcis->A_II = A_IIn;
5402 }
5403 }
5404 if (pcbddc->local_mat->symmetric_set) {
5405 ierr = MatSetOption(pcis->A_II,MAT_SYMMETRIC,pcbddc->local_mat->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5405,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5406 }
5407 /* Matrix for Dirichlet problem is pcis->A_II */
5408 n_D = pcis->n - pcis->n_B;
5409 opts = PETSC_FALSE;
5410 if (!pcbddc->ksp_D) { /* create object if not yet build */
5411 opts = PETSC_TRUE;
5412 ierr = KSPCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5412,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5413 ierr = PetscObjectIncrementTabLevel((PetscObject)pcbddc->ksp_D,(PetscObject)pc,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5413,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5414 /* default */
5415 ierr = KSPSetType(pcbddc->ksp_D,KSPPREONLY"preonly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5416 ierr = KSPSetOptionsPrefix(pcbddc->ksp_D,dir_prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5416,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5417 ierr = PetscObjectTypeCompare((PetscObject)pcis->pA_II,MATSEQSBAIJ"seqsbaij",&issbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5418 ierr = KSPGetPC(pcbddc->ksp_D,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5418,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5419 if (issbaij) {
5420 ierr = PCSetType(pc_temp,PCCHOLESKY"cholesky");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5421 } else {
5422 ierr = PCSetType(pc_temp,PCLU"lu");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5422,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5423 }
5424 ierr = KSPSetErrorIfNotConverged(pcbddc->ksp_D,pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5425 }
5426 ierr = MatSetOptionsPrefix(pcis->pA_II,((PetscObject)pcbddc->ksp_D)->prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5426,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5427 ierr = KSPSetOperators(pcbddc->ksp_D,pcis->A_II,pcis->pA_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5427,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5428 /* Allow user's customization */
5429 if (opts) {
5430 ierr = KSPSetFromOptions(pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5430,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5431 }
5432 if (pcbddc->NullSpace_corr[0]) { /* approximate solver, propagate NearNullSpace */
5433 ierr = MatNullSpacePropagate_Private(pcbddc->local_mat,pcis->is_I_local,pcis->pA_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5433,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5434 }
5435 ierr = MatGetNearNullSpace(pcis->pA_II,&nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5435,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5436 ierr = KSPGetPC(pcbddc->ksp_D,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5436,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5437 ierr = PetscObjectQueryFunction((PetscObject)pc_temp,"PCSetCoordinates_C",&f)PetscObjectQueryFunction_Private(((PetscObject)pc_temp),("PCSetCoordinates_C"
),(PetscVoidFunction*)(&f))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5437,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5438 if (f && pcbddc->mat_graph->cloc && !nnsp) {
5439 PetscReal *coords = pcbddc->mat_graph->coords,*scoords;
5440 const PetscInt *idxs;
5441 PetscInt cdim = pcbddc->mat_graph->cdim,nl,i,d;
5442
5443 ierr = ISGetLocalSize(pcis->is_I_local,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5443,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5444 ierr = ISGetIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5444,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5445 ierr = PetscMalloc1(nl*cdim,&scoords)PetscMallocA(1,PETSC_FALSE,5445,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nl*cdim)*sizeof(**(&scoords)),(&scoords))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5445,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5446 for (i=0;i<nl;i++) {
5447 for (d=0;d<cdim;d++) {
5448 scoords[i*cdim+d] = coords[idxs[i]*cdim+d];
5449 }
5450 }
5451 ierr = ISRestoreIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5451,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5452 ierr = PCSetCoordinates(pc_temp,cdim,nl,scoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5452,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5453 ierr = PetscFree(scoords)((*PetscTrFree)((void*)(scoords),5453,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((scoords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5453,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5454 }
5455 if (sub_schurs && sub_schurs->reuse_solver) {
5456 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5457
5458 ierr = KSPSetPC(pcbddc->ksp_D,reuse_solver->interior_solver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5458,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5459 }
5460
5461 /* umfpack interface has a bug when matrix dimension is zero. TODO solve from umfpack interface */
5462 if (!n_D) {
5463 ierr = KSPGetPC(pcbddc->ksp_D,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5464 ierr = PCSetType(pc_temp,PCNONE"none");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5464,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5465 }
5466 /* set ksp_D into pcis data */
5467 ierr = PetscObjectReference((PetscObject)pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5467,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5468 ierr = KSPDestroy(&pcis->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5468,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5469 pcis->ksp_D = pcbddc->ksp_D;
5470 }
5471
5472 /* NEUMANN PROBLEM */
5473 A_RR = 0;
5474 if (neumann) {
5475 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5476 PetscInt ibs,mbs;
5477 PetscBool issbaij, reuse_neumann_solver;
5478 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
5479
5480 reuse_neumann_solver = PETSC_FALSE;
5481 if (sub_schurs && sub_schurs->reuse_solver) {
5482 IS iP;
5483
5484 reuse_neumann_solver = PETSC_TRUE;
5485 ierr = PetscObjectQuery((PetscObject)sub_schurs->A,"__KSPFETIDP_iP",(PetscObject*)&iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5486 if (iP) reuse_neumann_solver = PETSC_FALSE;
5487 }
5488 /* Matrix for Neumann problem is A_RR -> we need to create/reuse it at this point */
5489 ierr = ISGetSize(pcbddc->is_R_local,&n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5490 if (pcbddc->ksp_R) { /* already created ksp */
5491 PetscInt nn_R;
5492 ierr = KSPGetOperators(pcbddc->ksp_R,NULL((void*)0),&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5492,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5493 ierr = PetscObjectReference((PetscObject)A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5494 ierr = MatGetSize(A_RR,&nn_R,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5495 if (nn_R != n_R) { /* old ksp is not reusable, so reset it */
5496 ierr = KSPReset(pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5497 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5498 reuse = MAT_INITIAL_MATRIX;
5499 } else { /* same sizes, but nonzero pattern depend on primal vertices so it can be changed */
5500 if (pcbddc->new_primal_space_local) { /* we are not sure the matrix will have the same nonzero pattern */
5501 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5501,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5502 reuse = MAT_INITIAL_MATRIX;
5503 } else { /* safe to reuse the matrix */
5504 reuse = MAT_REUSE_MATRIX;
5505 }
5506 }
5507 /* last check */
5508 if (pc->flag == DIFFERENT_NONZERO_PATTERN) {
5509 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5510 reuse = MAT_INITIAL_MATRIX;
5511 }
5512 } else { /* first time, so we need to create the matrix */
5513 reuse = MAT_INITIAL_MATRIX;
5514 }
5515 /* convert pcbddc->local_mat if needed later in PCBDDCSetUpCorrection */
5516 ierr = MatGetBlockSize(pcbddc->local_mat,&mbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5516,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5517 ierr = ISGetBlockSize(pcbddc->is_R_local,&ibs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5517,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5518 ierr = PetscObjectTypeCompare((PetscObject)pcbddc->local_mat,MATSEQSBAIJ"seqsbaij",&issbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5518,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5519 if (ibs != mbs) { /* need to convert to SEQAIJ to extract any submatrix with is_R_local */
5520 if (matis->A == pcbddc->local_mat) {
5521 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5522 ierr = MatConvert(matis->A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5523 } else {
5524 ierr = MatConvert(pcbddc->local_mat,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5524,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5525 }
5526 } else if (issbaij) { /* need to convert to BAIJ to get offdiagonal blocks */
5527 if (matis->A == pcbddc->local_mat) {
5528 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5528,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5529 ierr = MatConvert(matis->A,MATSEQBAIJ"seqbaij",MAT_INITIAL_MATRIX,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5529,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5530 } else {
5531 ierr = MatConvert(pcbddc->local_mat,MATSEQBAIJ"seqbaij",MAT_INPLACE_MATRIX,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5532 }
5533 }
5534 /* extract A_RR */
5535 if (reuse_neumann_solver) {
5536 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5537
5538 if (pcbddc->dbg_flag) { /* we need A_RR to test the solver later */
5539 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5539,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5540 if (reuse_solver->benign_n) { /* we are not using the explicit change of basis on the pressures */
5541 ierr = PCBDDCBenignProject(pc,pcbddc->is_R_local,pcbddc->is_R_local,&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5542 } else {
5543 ierr = MatCreateSubMatrix(pcbddc->local_mat,pcbddc->is_R_local,pcbddc->is_R_local,MAT_INITIAL_MATRIX,&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5543,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5544 }
5545 } else {
5546 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5546,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5547 ierr = PCGetOperators(reuse_solver->correction_solver,&A_RR,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5547,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5548 ierr = PetscObjectReference((PetscObject)A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5548,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5549 }
5550 } else { /* we have to build the neumann solver, so we need to extract the relevant matrix */
5551 ierr = MatCreateSubMatrix(pcbddc->local_mat,pcbddc->is_R_local,pcbddc->is_R_local,reuse,&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5552 }
5553 if (pcbddc->local_mat->symmetric_set) {
5554 ierr = MatSetOption(A_RR,MAT_SYMMETRIC,pcbddc->local_mat->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5555 }
5556 opts = PETSC_FALSE;
5557 if (!pcbddc->ksp_R) { /* create object if not present */
5558 opts = PETSC_TRUE;
5559 ierr = KSPCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5559,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5560 ierr = PetscObjectIncrementTabLevel((PetscObject)pcbddc->ksp_R,(PetscObject)pc,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5561 /* default */
5562 ierr = KSPSetType(pcbddc->ksp_R,KSPPREONLY"preonly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5562,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5563 ierr = KSPSetOptionsPrefix(pcbddc->ksp_R,neu_prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5563,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5564 ierr = KSPGetPC(pcbddc->ksp_R,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5564,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5565 ierr = PetscObjectTypeCompare((PetscObject)A_RR,MATSEQSBAIJ"seqsbaij",&issbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5565,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5566 if (issbaij) {
5567 ierr = PCSetType(pc_temp,PCCHOLESKY"cholesky");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5567,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5568 } else {
5569 ierr = PCSetType(pc_temp,PCLU"lu");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5570 }
5571 ierr = KSPSetErrorIfNotConverged(pcbddc->ksp_R,pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5571,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5572 }
5573 ierr = KSPSetOperators(pcbddc->ksp_R,A_RR,A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5574 ierr = MatSetOptionsPrefix(A_RR,((PetscObject)pcbddc->ksp_R)->prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5574,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5575 if (opts) { /* Allow user's customization once */
5576 ierr = KSPSetFromOptions(pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5576,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5577 }
5578 if (pcbddc->NullSpace_corr[2]) { /* approximate solver, propagate NearNullSpace */
5579 ierr = MatNullSpacePropagate_Private(pcbddc->local_mat,pcbddc->is_R_local,A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5579,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5580 }
5581 ierr = MatGetNearNullSpace(A_RR,&nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5581,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5582 ierr = KSPGetPC(pcbddc->ksp_R,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5582,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5583 ierr = PetscObjectQueryFunction((PetscObject)pc_temp,"PCSetCoordinates_C",&f)PetscObjectQueryFunction_Private(((PetscObject)pc_temp),("PCSetCoordinates_C"
),(PetscVoidFunction*)(&f))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5584 if (f && pcbddc->mat_graph->cloc && !nnsp) {
5585 PetscReal *coords = pcbddc->mat_graph->coords,*scoords;
5586 const PetscInt *idxs;
5587 PetscInt cdim = pcbddc->mat_graph->cdim,nl,i,d;
5588
5589 ierr = ISGetLocalSize(pcbddc->is_R_local,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5589,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5590 ierr = ISGetIndices(pcbddc->is_R_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5590,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5591 ierr = PetscMalloc1(nl*cdim,&scoords)PetscMallocA(1,PETSC_FALSE,5591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nl*cdim)*sizeof(**(&scoords)),(&scoords))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5592 for (i=0;i<nl;i++) {
5593 for (d=0;d<cdim;d++) {
5594 scoords[i*cdim+d] = coords[idxs[i]*cdim+d];
5595 }
5596 }
5597 ierr = ISRestoreIndices(pcbddc->is_R_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5597,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5598 ierr = PCSetCoordinates(pc_temp,cdim,nl,scoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5598,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5599 ierr = PetscFree(scoords)((*PetscTrFree)((void*)(scoords),5599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((scoords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5600 }
5601
5602 /* umfpack interface has a bug when matrix dimension is zero. TODO solve from umfpack interface */
5603 if (!n_R) {
5604 ierr = KSPGetPC(pcbddc->ksp_R,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5604,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5605 ierr = PCSetType(pc_temp,PCNONE"none");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5605,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5606 }
5607 /* Reuse solver if it is present */
5608 if (reuse_neumann_solver) {
5609 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5610
5611 ierr = KSPSetPC(pcbddc->ksp_R,reuse_solver->correction_solver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5611,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5612 }
5613 }
5614
5615 if (pcbddc->dbg_flag) {
5616 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5616,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5617 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5617,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5618 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5619 }
5620
5621 /* adapt Dirichlet and Neumann solvers if a nullspace correction has been requested */
5622 if (pcbddc->NullSpace_corr[0]) {
5623 ierr = PCBDDCSetUseExactDirichlet(pc,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5623,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5624 }
5625 if (dirichlet && pcbddc->NullSpace_corr[0] && !pcbddc->switch_static) {
5626 ierr = PCBDDCNullSpaceAssembleCorrection(pc,PETSC_TRUE,pcbddc->NullSpace_corr[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5626,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5627 }
5628 if (neumann && pcbddc->NullSpace_corr[2]) {
5629 ierr = PCBDDCNullSpaceAssembleCorrection(pc,PETSC_FALSE,pcbddc->NullSpace_corr[3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5629,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5630 }
5631 /* check Dirichlet and Neumann solvers */
5632 if (pcbddc->dbg_flag) {
5633 if (dirichlet) { /* Dirichlet */
5634 ierr = VecSetRandom(pcis->vec1_D,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5634,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5635 ierr = MatMult(pcis->A_II,pcis->vec1_D,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5636 ierr = KSPSolve(pcbddc->ksp_D,pcis->vec2_D,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5637 ierr = KSPCheckSolve(pcbddc->ksp_D,pc,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5637,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5638 ierr = VecAXPY(pcis->vec1_D,m_one,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5638,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5639 ierr = VecNorm(pcis->vec1_D,NORM_INFINITY,&value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5640 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d infinity error for Dirichlet solve (%s) = % 1.14e \n",PetscGlobalRank,((PetscObject)(pcbddc->ksp_D))->prefix,value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5640,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5641 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5641,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5642 }
5643 if (neumann) { /* Neumann */
5644 ierr = VecSetRandom(pcbddc->vec1_R,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5645 ierr = MatMult(A_RR,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5645,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5646 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec2_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5647 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5648 ierr = VecAXPY(pcbddc->vec1_R,m_one,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5648,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5649 ierr = VecNorm(pcbddc->vec1_R,NORM_INFINITY,&value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5650 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d infinity error for Neumann solve (%s) = % 1.14e\n",PetscGlobalRank,((PetscObject)(pcbddc->ksp_R))->prefix,value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5651 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5652 }
5653 }
5654 /* free Neumann problem's matrix */
5655 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5656 ierr = PetscLogEventEnd(PC_BDDC_LocalSolvers[pcbddc->current_level],pc,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_LocalSolvers[pcbddc->current_level]].active) ? (*
PetscLogPLE)((PC_BDDC_LocalSolvers[pcbddc->current_level])
,0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5656,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5657 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5658}
5659
5660static PetscErrorCode PCBDDCSolveSubstructureCorrection(PC pc, Vec inout_B, Vec inout_D, PetscBool applytranspose)
5661{
5662 PetscErrorCode ierr;
5663 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5664 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5665 PetscBool reuse_solver = sub_schurs ? ( sub_schurs->reuse_solver ? PETSC_TRUE : PETSC_FALSE ) : PETSC_FALSE;
5666
5667 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5667; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5668 if (!reuse_solver) {
5669 ierr = VecSet(pcbddc->vec1_R,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5669,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5670 }
5671 if (!pcbddc->switch_static) {
5672 if (applytranspose && pcbddc->local_auxmat1) {
5673 ierr = MatMultTranspose(pcbddc->local_auxmat2,inout_B,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5674 ierr = MatMultTransposeAdd(pcbddc->local_auxmat1,pcbddc->vec1_C,inout_B,inout_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5675 }
5676 if (!reuse_solver) {
5677 ierr = VecScatterBegin(pcbddc->R_to_B,inout_B,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5677,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5678 ierr = VecScatterEnd(pcbddc->R_to_B,inout_B,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5679 } else {
5680 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5681
5682 ierr = VecScatterBegin(reuse_solver->correction_scatter_B,inout_B,reuse_solver->rhs_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5682,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5683 ierr = VecScatterEnd(reuse_solver->correction_scatter_B,inout_B,reuse_solver->rhs_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5683,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5684 }
5685 } else {
5686 ierr = VecScatterBegin(pcbddc->R_to_B,inout_B,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5686,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5687 ierr = VecScatterEnd(pcbddc->R_to_B,inout_B,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5687,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5688 ierr = VecScatterBegin(pcbddc->R_to_D,inout_D,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5689 ierr = VecScatterEnd(pcbddc->R_to_D,inout_D,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5689,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5690 if (applytranspose && pcbddc->local_auxmat1) {
5691 ierr = MatMultTranspose(pcbddc->local_auxmat2,pcbddc->vec1_R,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5691,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5692 ierr = MatMultTransposeAdd(pcbddc->local_auxmat1,pcbddc->vec1_C,inout_B,inout_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5693 ierr = VecScatterBegin(pcbddc->R_to_B,inout_B,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5694 ierr = VecScatterEnd(pcbddc->R_to_B,inout_B,pcbddc->vec1_R,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5694,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5695 }
5696 }
5697 if (!reuse_solver || pcbddc->switch_static) {
5698 if (applytranspose) {
5699 ierr = KSPSolveTranspose(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5700 } else {
5701 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5701,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5702 }
5703 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5704 } else {
5705 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5706
5707 if (applytranspose) {
5708 ierr = MatFactorSolveSchurComplementTranspose(reuse_solver->F,reuse_solver->rhs_B,reuse_solver->sol_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5708,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5709 } else {
5710 ierr = MatFactorSolveSchurComplement(reuse_solver->F,reuse_solver->rhs_B,reuse_solver->sol_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5710,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5711 }
5712 }
5713 ierr = VecSet(inout_B,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5714 if (!pcbddc->switch_static) {
5715 if (!reuse_solver) {
5716 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,inout_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5716,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5717 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,inout_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5718 } else {
5719 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5720
5721 ierr = VecScatterBegin(reuse_solver->correction_scatter_B,reuse_solver->sol_B,inout_B,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5721,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5722 ierr = VecScatterEnd(reuse_solver->correction_scatter_B,reuse_solver->sol_B,inout_B,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5722,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5723 }
5724 if (!applytranspose && pcbddc->local_auxmat1) {
5725 ierr = MatMult(pcbddc->local_auxmat1,inout_B,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5725,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5726 ierr = MatMultAdd(pcbddc->local_auxmat2,pcbddc->vec1_C,inout_B,inout_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5726,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5727 }
5728 } else {
5729 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,inout_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5729,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5730 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,inout_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5730,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5731 ierr = VecScatterBegin(pcbddc->R_to_D,pcbddc->vec1_R,inout_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5732 ierr = VecScatterEnd(pcbddc->R_to_D,pcbddc->vec1_R,inout_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5732,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5733 if (!applytranspose && pcbddc->local_auxmat1) {
5734 ierr = MatMult(pcbddc->local_auxmat1,inout_B,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5735 ierr = MatMultAdd(pcbddc->local_auxmat2,pcbddc->vec1_C,pcbddc->vec1_R,pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5735,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5736 }
5737 ierr = VecScatterBegin(pcbddc->R_to_B,pcbddc->vec1_R,inout_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5737,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5738 ierr = VecScatterEnd(pcbddc->R_to_B,pcbddc->vec1_R,inout_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5738,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5739 ierr = VecScatterBegin(pcbddc->R_to_D,pcbddc->vec1_R,inout_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5740 ierr = VecScatterEnd(pcbddc->R_to_D,pcbddc->vec1_R,inout_D,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5740,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5741 }
5742 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5743}
5744
5745/* parameter apply transpose determines if the interface preconditioner should be applied transposed or not */
5746PetscErrorCode PCBDDCApplyInterfacePreconditioner(PC pc, PetscBool applytranspose)
5747{
5748 PetscErrorCode ierr;
5749 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5750 PC_IS* pcis = (PC_IS*) (pc->data);
5751 const PetscScalar zero = 0.0;
5752
5753 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5753; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5754 /* Application of PSI^T or PHI^T (depending on applytranspose, see comment above) */
5755 if (!pcbddc->benign_apply_coarse_only) {
5756 if (applytranspose) {
5757 ierr = MatMultTranspose(pcbddc->coarse_phi_B,pcis->vec1_B,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5757,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5758 if (pcbddc->switch_static) { ierr = MatMultTransposeAdd(pcbddc->coarse_phi_D,pcis->vec1_D,pcbddc->vec1_P,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5758,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5759 } else {
5760 ierr = MatMultTranspose(pcbddc->coarse_psi_B,pcis->vec1_B,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5760,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5761 if (pcbddc->switch_static) { ierr = MatMultTransposeAdd(pcbddc->coarse_psi_D,pcis->vec1_D,pcbddc->vec1_P,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5761,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5762 }
5763 } else {
5764 ierr = VecSet(pcbddc->vec1_P,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5764,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5765 }
5766
5767 /* add p0 to the last value of vec1_P holding the coarse dof relative to p0 */
5768 if (pcbddc->benign_n) {
5769 PetscScalar *array;
5770 PetscInt j;
5771
5772 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5773 for (j=0;j<pcbddc->benign_n;j++) array[pcbddc->local_primal_size-pcbddc->benign_n+j] += pcbddc->benign_p0[j];
5774 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5774,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5775 }
5776
5777 /* start communications from local primal nodes to rhs of coarse solver */
5778 ierr = VecSet(pcbddc->coarse_vec,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5778,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5779 ierr = PCBDDCScatterCoarseDataBegin(pc,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5779,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5780 ierr = PCBDDCScatterCoarseDataEnd(pc,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5780,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5781
5782 /* Coarse solution -> rhs and sol updated inside PCBDDCScattarCoarseDataBegin/End */
5783 if (pcbddc->coarse_ksp) {
5784 Mat coarse_mat;
5785 Vec rhs,sol;
5786 MatNullSpace nullsp;
5787 PetscBool isbddc = PETSC_FALSE;
5788
5789 if (pcbddc->benign_have_null) {
5790 PC coarse_pc;
5791
5792 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5793 ierr = PetscObjectTypeCompare((PetscObject)coarse_pc,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5794 /* we need to propagate to coarser levels the need for a possible benign correction */
5795 if (isbddc && pcbddc->benign_apply_coarse_only && !pcbddc->benign_skip_correction) {
5796 PC_BDDC* coarsepcbddc = (PC_BDDC*)(coarse_pc->data);
5797 coarsepcbddc->benign_skip_correction = PETSC_FALSE;
5798 coarsepcbddc->benign_apply_coarse_only = PETSC_TRUE;
5799 }
5800 }
5801 ierr = KSPGetRhs(pcbddc->coarse_ksp,&rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5802 ierr = KSPGetSolution(pcbddc->coarse_ksp,&sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5803 ierr = KSPGetOperators(pcbddc->coarse_ksp,&coarse_mat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5804 if (applytranspose) {
5805 if (pcbddc->benign_apply_coarse_only) SETERRQ(PetscObjectComm((PetscObject)pcbddc->coarse_ksp),PETSC_ERR_SUP,"Not yet implemented")return PetscError(PetscObjectComm((PetscObject)pcbddc->coarse_ksp
),5805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
5806 ierr = KSPSolveTranspose(pcbddc->coarse_ksp,rhs,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5807 ierr = KSPCheckSolve(pcbddc->coarse_ksp,pc,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5807,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5808 ierr = MatGetTransposeNullSpace(coarse_mat,&nullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5809 if (nullsp) {
5810 ierr = MatNullSpaceRemove(nullsp,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5810,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5811 }
5812 } else {
5813 ierr = MatGetNullSpace(coarse_mat,&nullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5813,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5814 if (pcbddc->benign_apply_coarse_only && isbddc) { /* need just to apply the coarse preconditioner during presolve */
5815 PC coarse_pc;
5816
5817 if (nullsp) {
5818 ierr = MatNullSpaceRemove(nullsp,rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5819 }
5820 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5821 ierr = PCPreSolve(coarse_pc,pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5822 ierr = PCBDDCBenignRemoveInterior(coarse_pc,rhs,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5822,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5823 ierr = PCPostSolve(coarse_pc,pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5824 } else {
5825 ierr = KSPSolve(pcbddc->coarse_ksp,rhs,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5826 ierr = KSPCheckSolve(pcbddc->coarse_ksp,pc,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5827 if (nullsp) {
5828 ierr = MatNullSpaceRemove(nullsp,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5828,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5829 }
5830 }
5831 }
5832 /* we don't need the benign correction at coarser levels anymore */
5833 if (pcbddc->benign_have_null && isbddc) {
5834 PC coarse_pc;
5835 PC_BDDC* coarsepcbddc;
5836
5837 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5837,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5838 coarsepcbddc = (PC_BDDC*)(coarse_pc->data);
5839 coarsepcbddc->benign_skip_correction = PETSC_TRUE;
5840 coarsepcbddc->benign_apply_coarse_only = PETSC_FALSE;
5841 }
5842 }
5843
5844 /* Local solution on R nodes */
5845 if (pcis->n && !pcbddc->benign_apply_coarse_only) {
5846 ierr = PCBDDCSolveSubstructureCorrection(pc,pcis->vec1_B,pcis->vec1_D,applytranspose);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5846,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5847 }
5848 /* communications from coarse sol to local primal nodes */
5849 ierr = PCBDDCScatterCoarseDataBegin(pc,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5849,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5850 ierr = PCBDDCScatterCoarseDataEnd(pc,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5850,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5851
5852 /* Sum contributions from the two levels */
5853 if (!pcbddc->benign_apply_coarse_only) {
5854 if (applytranspose) {
5855 ierr = MatMultAdd(pcbddc->coarse_psi_B,pcbddc->vec1_P,pcis->vec1_B,pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5855,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5856 if (pcbddc->switch_static) { ierr = MatMultAdd(pcbddc->coarse_psi_D,pcbddc->vec1_P,pcis->vec1_D,pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5857 } else {
5858 ierr = MatMultAdd(pcbddc->coarse_phi_B,pcbddc->vec1_P,pcis->vec1_B,pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5859 if (pcbddc->switch_static) { ierr = MatMultAdd(pcbddc->coarse_phi_D,pcbddc->vec1_P,pcis->vec1_D,pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5860 }
5861 /* store p0 */
5862 if (pcbddc->benign_n) {
5863 PetscScalar *array;
5864 PetscInt j;
5865
5866 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5867 for (j=0;j<pcbddc->benign_n;j++) pcbddc->benign_p0[j] = array[pcbddc->local_primal_size-pcbddc->benign_n+j];
5868 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5869 }
5870 } else { /* expand the coarse solution */
5871 if (applytranspose) {
5872 ierr = MatMult(pcbddc->coarse_psi_B,pcbddc->vec1_P,pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5872,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5873 } else {
5874 ierr = MatMult(pcbddc->coarse_phi_B,pcbddc->vec1_P,pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5875 }
5876 }
5877 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5878}
5879
5880PetscErrorCode PCBDDCScatterCoarseDataBegin(PC pc,InsertMode imode, ScatterMode smode)
5881{
5882 PetscErrorCode ierr;
5883 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5884 PetscScalar *array;
5885 Vec from,to;
5886
5887 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5887; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5888 if (smode == SCATTER_REVERSE) { /* from global to local -> get data from coarse solution */
5889 from = pcbddc->coarse_vec;
5890 to = pcbddc->vec1_P;
5891 if (pcbddc->coarse_ksp) { /* get array from coarse processes */
5892 Vec tvec;
5893
5894 ierr = KSPGetRhs(pcbddc->coarse_ksp,&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5894,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5895 ierr = VecResetArray(tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5895,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5896 ierr = KSPGetSolution(pcbddc->coarse_ksp,&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5897 ierr = VecGetArray(tvec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5898 ierr = VecPlaceArray(from,array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5898,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5899 ierr = VecRestoreArray(tvec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5899,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5900 }
5901 } else { /* from local to global -> put data in coarse right hand side */
5902 from = pcbddc->vec1_P;
5903 to = pcbddc->coarse_vec;
5904 }
5905 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,from,to,imode,smode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5906 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5907}
5908
5909PetscErrorCode PCBDDCScatterCoarseDataEnd(PC pc, InsertMode imode, ScatterMode smode)
5910{
5911 PetscErrorCode ierr;
5912 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5913 PetscScalar *array;
5914 Vec from,to;
5915
5916 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5916; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5917 if (smode == SCATTER_REVERSE) { /* from global to local -> get data from coarse solution */
5918 from = pcbddc->coarse_vec;
5919 to = pcbddc->vec1_P;
5920 } else { /* from local to global -> put data in coarse right hand side */
5921 from = pcbddc->vec1_P;
5922 to = pcbddc->coarse_vec;
5923 }
5924 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,from,to,imode,smode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5924,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5925 if (smode == SCATTER_FORWARD) {
5926 if (pcbddc->coarse_ksp) { /* get array from coarse processes */
5927 Vec tvec;
5928
5929 ierr = KSPGetRhs(pcbddc->coarse_ksp,&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5929,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5930 ierr = VecGetArray(to,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5930,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5931 ierr = VecPlaceArray(tvec,array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5931,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5932 ierr = VecRestoreArray(to,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5932,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5933 }
5934 } else {
5935 if (pcbddc->coarse_ksp) { /* restore array of pcbddc->coarse_vec */
5936 ierr = VecResetArray(from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5936,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5937 }
5938 }
5939 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5940}
5941
5942/* uncomment for testing purposes */
5943/* #define PETSC_MISSING_LAPACK_GESVD 1 */
5944PetscErrorCode PCBDDCConstraintsSetUp(PC pc)
5945{
5946 PetscErrorCode ierr;
5947 PC_IS* pcis = (PC_IS*)(pc->data);
5948 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
5949 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
5950 /* one and zero */
5951 PetscScalar one=1.0,zero=0.0;
5952 /* space to store constraints and their local indices */
5953 PetscScalar *constraints_data;
5954 PetscInt *constraints_idxs,*constraints_idxs_B;
5955 PetscInt *constraints_idxs_ptr,*constraints_data_ptr;
5956 PetscInt *constraints_n;
5957 /* iterators */
5958 PetscInt i,j,k,total_counts,total_counts_cc,cum;
5959 /* BLAS integers */
5960 PetscBLASInt lwork,lierr;
5961 PetscBLASInt Blas_N,Blas_M,Blas_K,Blas_one=1;
5962 PetscBLASInt Blas_LDA,Blas_LDB,Blas_LDC;
5963 /* reuse */
5964 PetscInt olocal_primal_size,olocal_primal_size_cc;
5965 PetscInt *olocal_primal_ref_node,*olocal_primal_ref_mult;
5966 /* change of basis */
5967 PetscBool qr_needed;
5968 PetscBT change_basis,qr_needed_idx;
5969 /* auxiliary stuff */
5970 PetscInt *nnz,*is_indices;
5971 PetscInt ncc;
5972 /* some quantities */
5973 PetscInt n_vertices,total_primal_vertices,valid_constraints;
5974 PetscInt size_of_constraint,max_size_of_constraint=0,max_constraints,temp_constraints;
5975 PetscReal tol; /* tolerance for retaining eigenmodes */
5976
5977 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5977; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5978 tol = PetscSqrtReal(PETSC_SMALL)sqrt(1.e-10);
5979 /* Destroy Mat objects computed previously */
5980 ierr = MatDestroy(&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5981 ierr = MatDestroy(&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5982 ierr = MatDestroy(&pcbddc->switch_static_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5982,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5983 /* save info on constraints from previous setup (if any) */
5984 olocal_primal_size = pcbddc->local_primal_size;
5985 olocal_primal_size_cc = pcbddc->local_primal_size_cc;
5986 ierr = PetscMalloc2(olocal_primal_size_cc,&olocal_primal_ref_node,olocal_primal_size_cc,&olocal_primal_ref_mult)PetscMallocA(2,PETSC_FALSE,5986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(olocal_primal_size_cc)*sizeof(**(&olocal_primal_ref_node
)),(&olocal_primal_ref_node),(size_t)(olocal_primal_size_cc
)*sizeof(**(&olocal_primal_ref_mult)),(&olocal_primal_ref_mult
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5987 ierr = PetscMemcpy(olocal_primal_ref_node,pcbddc->local_primal_ref_node,olocal_primal_size_cc*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5987,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5988 ierr = PetscMemcpy(olocal_primal_ref_mult,pcbddc->local_primal_ref_mult,olocal_primal_size_cc*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5988,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5989 ierr = PetscFree2(pcbddc->local_primal_ref_node,pcbddc->local_primal_ref_mult)PetscFreeA(2,5989,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->local_primal_ref_node),&(pcbddc->local_primal_ref_mult
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5989,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5990 ierr = PetscFree(pcbddc->primal_indices_local_idxs)((*PetscTrFree)((void*)(pcbddc->primal_indices_local_idxs)
,5990,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->primal_indices_local_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5990,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5991
5992 if (!pcbddc->adaptive_selection) {
5993 IS ISForVertices,*ISForFaces,*ISForEdges;
5994 MatNullSpace nearnullsp;
5995 const Vec *nearnullvecs;
5996 Vec *localnearnullsp;
5997 PetscScalar *array;
5998 PetscInt n_ISForFaces,n_ISForEdges,nnsp_size;
5999 PetscBool nnsp_has_cnst;
6000 /* LAPACK working arrays for SVD or POD */
6001 PetscBool skip_lapack,boolforchange;
6002 PetscScalar *work;
6003 PetscReal *singular_vals;
6004#if defined(PETSC_USE_COMPLEX)
6005 PetscReal *rwork;
6006#endif
6007#if defined(PETSC_MISSING_LAPACK_GESVD)
6008 PetscScalar *temp_basis,*correlation_mat;
6009#else
6010 PetscBLASInt dummy_int=1;
6011 PetscScalar dummy_scalar=1.;
6012#endif
6013
6014 /* Get index sets for faces, edges and vertices from graph */
6015 ierr = PCBDDCGraphGetCandidatesIS(pcbddc->mat_graph,&n_ISForFaces,&ISForFaces,&n_ISForEdges,&ISForEdges,&ISForVertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6015,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6016 /* print some info */
6017 if (pcbddc->dbg_flag && (!pcbddc->sub_schurs || pcbddc->sub_schurs_rebuild)) {
6018 PetscInt nv;
6019
6020 ierr = PCBDDCGraphASCIIView(pcbddc->mat_graph,pcbddc->dbg_flag,pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6020,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6021 ierr = ISGetSize(ISForVertices,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6021,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6022 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6022,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6023 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"--------------------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6023,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6024 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d got %02d local candidate vertices (%D)\n",PetscGlobalRank,nv,pcbddc->use_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6024,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6025 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d got %02d local candidate edges (%D)\n",PetscGlobalRank,n_ISForEdges,pcbddc->use_edges);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6025,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6026 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d got %02d local candidate faces (%D)\n",PetscGlobalRank,n_ISForFaces,pcbddc->use_faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6026,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6027 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6027,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6028 ierr = PetscViewerASCIIPopSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6028,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6029 }
6030
6031 /* free unneeded index sets */
6032 if (!pcbddc->use_vertices) {
6033 ierr = ISDestroy(&ISForVertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6033,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6034 }
6035 if (!pcbddc->use_edges) {
6036 for (i=0;i<n_ISForEdges;i++) {
6037 ierr = ISDestroy(&ISForEdges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6037,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6038 }
6039 ierr = PetscFree(ISForEdges)((*PetscTrFree)((void*)(ISForEdges),6039,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForEdges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6039,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6040 n_ISForEdges = 0;
6041 }
6042 if (!pcbddc->use_faces) {
6043 for (i=0;i<n_ISForFaces;i++) {
6044 ierr = ISDestroy(&ISForFaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6044,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6045 }
6046 ierr = PetscFree(ISForFaces)((*PetscTrFree)((void*)(ISForFaces),6046,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForFaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6046,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6047 n_ISForFaces = 0;
6048 }
6049
6050 /* check if near null space is attached to global mat */
6051 ierr = MatGetNearNullSpace(pc->pmat,&nearnullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6052 if (nearnullsp) {
6053 ierr = MatNullSpaceGetVecs(nearnullsp,&nnsp_has_cnst,&nnsp_size,&nearnullvecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6053,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6054 /* remove any stored info */
6055 ierr = MatNullSpaceDestroy(&pcbddc->onearnullspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6055,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6056 ierr = PetscFree(pcbddc->onearnullvecs_state)((*PetscTrFree)((void*)(pcbddc->onearnullvecs_state),6056,
__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->onearnullvecs_state) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6057 /* store information for BDDC solver reuse */
6058 ierr = PetscObjectReference((PetscObject)nearnullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6059 pcbddc->onearnullspace = nearnullsp;
6060 ierr = PetscMalloc1(nnsp_size,&pcbddc->onearnullvecs_state)PetscMallocA(1,PETSC_FALSE,6060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nnsp_size)*sizeof(**(&pcbddc->onearnullvecs_state
)),(&pcbddc->onearnullvecs_state))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6061 for (i=0;i<nnsp_size;i++) {
6062 ierr = PetscObjectStateGet((PetscObject)nearnullvecs[i],&pcbddc->onearnullvecs_state[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6062,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6063 }
6064 } else { /* if near null space is not provided BDDC uses constants by default */
6065 nnsp_size = 0;
6066 nnsp_has_cnst = PETSC_TRUE;
6067 }
6068 /* get max number of constraints on a single cc */
6069 max_constraints = nnsp_size;
6070 if (nnsp_has_cnst) max_constraints++;
6071
6072 /*
6073 Evaluate maximum storage size needed by the procedure
6074 - Indices for connected component i stored at "constraints_idxs + constraints_idxs_ptr[i]"
6075 - Values for constraints on connected component i stored at "constraints_data + constraints_data_ptr[i]"
6076 There can be multiple constraints per connected component
6077 */
6078 n_vertices = 0;
6079 if (ISForVertices) {
6080 ierr = ISGetSize(ISForVertices,&n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6081 }
6082 ncc = n_vertices+n_ISForFaces+n_ISForEdges;
6083 ierr = PetscMalloc3(ncc+1,&constraints_idxs_ptr,ncc+1,&constraints_data_ptr,ncc,&constraints_n)PetscMallocA(3,PETSC_FALSE,6083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ncc+1)*sizeof(**(&constraints_idxs_ptr)),(&
constraints_idxs_ptr),(size_t)(ncc+1)*sizeof(**(&constraints_data_ptr
)),(&constraints_data_ptr),(size_t)(ncc)*sizeof(**(&constraints_n
)),(&constraints_n))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6084
6085 total_counts = n_ISForFaces+n_ISForEdges;
6086 total_counts *= max_constraints;
6087 total_counts += n_vertices;
6088 ierr = PetscBTCreate(total_counts,&change_basis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6088,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6089
6090 total_counts = 0;
6091 max_size_of_constraint = 0;
6092 for (i=0;i<n_ISForEdges+n_ISForFaces;i++) {
6093 IS used_is;
6094 if (i<n_ISForEdges) {
6095 used_is = ISForEdges[i];
6096 } else {
6097 used_is = ISForFaces[i-n_ISForEdges];
6098 }
6099 ierr = ISGetSize(used_is,&j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6099,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6100 total_counts += j;
6101 max_size_of_constraint = PetscMax(j,max_size_of_constraint)(((j)<(max_size_of_constraint)) ? (max_size_of_constraint)
: (j))
;
6102 }
6103 ierr = PetscMalloc3(total_counts*max_constraints+n_vertices,&constraints_data,total_counts+n_vertices,&constraints_idxs,total_counts+n_vertices,&constraints_idxs_B)PetscMallocA(3,PETSC_FALSE,6103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(total_counts*max_constraints+n_vertices)*sizeof(**(
&constraints_data)),(&constraints_data),(size_t)(total_counts
+n_vertices)*sizeof(**(&constraints_idxs)),(&constraints_idxs
),(size_t)(total_counts+n_vertices)*sizeof(**(&constraints_idxs_B
)),(&constraints_idxs_B))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6103,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6104
6105 /* get local part of global near null space vectors */
6106 ierr = PetscMalloc1(nnsp_size,&localnearnullsp)PetscMallocA(1,PETSC_FALSE,6106,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nnsp_size)*sizeof(**(&localnearnullsp)),(&localnearnullsp
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6106,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6107 for (k=0;k<nnsp_size;k++) {
6108 ierr = VecDuplicate(pcis->vec1_N,&localnearnullsp[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6109 ierr = VecScatterBegin(matis->rctx,nearnullvecs[k],localnearnullsp[k],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6109,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6110 ierr = VecScatterEnd(matis->rctx,nearnullvecs[k],localnearnullsp[k],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6110,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6111 }
6112
6113 /* whether or not to skip lapack calls */
6114 skip_lapack = PETSC_TRUE;
6115 if (n_ISForFaces+n_ISForEdges && max_constraints > 1 && !pcbddc->use_nnsp_true) skip_lapack = PETSC_FALSE;
6116
6117 /* First we issue queries to allocate optimal workspace for LAPACKgesvd (or LAPACKsyev if SVD is missing) */
6118 if (!skip_lapack) {
6119 PetscScalar temp_work;
6120
6121#if defined(PETSC_MISSING_LAPACK_GESVD)
6122 /* Proper Orthogonal Decomposition (POD) using the snapshot method */
6123 ierr = PetscMalloc1(max_constraints*max_constraints,&correlation_mat)PetscMallocA(1,PETSC_FALSE,6123,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(max_constraints*max_constraints)*sizeof(**(&correlation_mat
)),(&correlation_mat))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6123,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6124 ierr = PetscMalloc1(max_constraints,&singular_vals)PetscMallocA(1,PETSC_FALSE,6124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(max_constraints)*sizeof(**(&singular_vals)),(&
singular_vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6124,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6125 ierr = PetscMalloc1(max_size_of_constraint*max_constraints,&temp_basis)PetscMallocA(1,PETSC_FALSE,6125,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(max_size_of_constraint*max_constraints)*sizeof(**(&
temp_basis)),(&temp_basis))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6125,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6126#if defined(PETSC_USE_COMPLEX)
6127 ierr = PetscMalloc1(3*max_constraints,&rwork)PetscMallocA(1,PETSC_FALSE,6127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(3*max_constraints)*sizeof(**(&rwork)),(&rwork
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6127,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6128#endif
6129 /* now we evaluate the optimal workspace using query with lwork=-1 */
6130 ierr = PetscBLASIntCast(max_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6130,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6131 ierr = PetscBLASIntCast(max_constraints,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6132 lwork = -1;
6133 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6134#if !defined(PETSC_USE_COMPLEX)
6135 PetscStackCallBLAS("LAPACKsyev",LAPACKsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals,&temp_work,&lwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsyev"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6135; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals
,&temp_work,&lwork,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(6135,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6135,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6136#else
6137 PetscStackCallBLAS("LAPACKsyev",LAPACKsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals,&temp_work,&lwork,rwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsyev"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6137; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals
,&temp_work,&lwork,rwork,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(6137,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6137,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6138#endif
6139 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6139,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6140 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to SYEV Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6140,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to SYEV Lapack routine %d"
,(int)lierr)
;
6141#else /* on missing GESVD */
6142 /* SVD */
6143 PetscInt max_n,min_n;
6144 max_n = max_size_of_constraint;
6145 min_n = max_constraints;
6146 if (max_size_of_constraint < max_constraints) {
6147 min_n = max_size_of_constraint;
6148 max_n = max_constraints;
6149 }
6150 ierr = PetscMalloc1(min_n,&singular_vals)PetscMallocA(1,PETSC_FALSE,6150,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(min_n)*sizeof(**(&singular_vals)),(&singular_vals
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6150,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6151#if defined(PETSC_USE_COMPLEX)
6152 ierr = PetscMalloc1(5*min_n,&rwork)PetscMallocA(1,PETSC_FALSE,6152,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(5*min_n)*sizeof(**(&rwork)),(&rwork))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6152,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6153#endif
6154 /* now we evaluate the optimal workspace using query with lwork=-1 */
6155 lwork = -1;
6156 ierr = PetscBLASIntCast(max_n,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6156,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6157 ierr = PetscBLASIntCast(min_n,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6157,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6158 ierr = PetscBLASIntCast(max_n,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6158,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6159 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6159,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6160#if !defined(PETSC_USE_COMPLEX)
6161 PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("O","N",&Blas_M,&Blas_N,&constraints_data[0],&Blas_LDA,singular_vals,&dummy_scalar,&dummy_int,&dummy_scalar,&dummy_int,&temp_work,&lwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKgesvd"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6161; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgesvd_("O","N",&Blas_M,&Blas_N,&constraints_data
[0],&Blas_LDA,singular_vals,&dummy_scalar,&dummy_int
,&dummy_scalar,&dummy_int,&temp_work,&lwork,&
lierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(6161,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6161,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6162#else
6163 PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("O","N",&Blas_M,&Blas_N,&constraints_data[0],&Blas_LDA,singular_vals,&dummy_scalar,&dummy_int,&dummy_scalar,&dummy_int,&temp_work,&lwork,rwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKgesvd"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6163; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgesvd_("O","N",&Blas_M,&Blas_N,&constraints_data
[0],&Blas_LDA,singular_vals,&dummy_scalar,&dummy_int
,&dummy_scalar,&dummy_int,&temp_work,&lwork,rwork
,&lierr); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(6163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6163,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6164#endif
6165 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6166 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to GESVD Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to GESVD Lapack routine %d"
,(int)lierr)
;
6167#endif /* on missing GESVD */
6168 /* Allocate optimal workspace */
6169 ierr = PetscBLASIntCast((PetscInt)PetscRealPart(temp_work)(temp_work),&lwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6169,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6170 ierr = PetscMalloc1(lwork,&work)PetscMallocA(1,PETSC_FALSE,6170,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(lwork)*sizeof(**(&work)),(&work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6170,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6171 }
6172 /* Now we can loop on constraining sets */
6173 total_counts = 0;
6174 constraints_idxs_ptr[0] = 0;
6175 constraints_data_ptr[0] = 0;
6176 /* vertices */
6177 if (n_vertices) {
6178 ierr = ISGetIndices(ISForVertices,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6178,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6179 ierr = PetscMemcpy(constraints_idxs,is_indices,n_vertices*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6180 for (i=0;i<n_vertices;i++) {
6181 constraints_n[total_counts] = 1;
6182 constraints_data[total_counts] = 1.0;
6183 constraints_idxs_ptr[total_counts+1] = constraints_idxs_ptr[total_counts]+1;
6184 constraints_data_ptr[total_counts+1] = constraints_data_ptr[total_counts]+1;
6185 total_counts++;
6186 }
6187 ierr = ISRestoreIndices(ISForVertices,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6187,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6188 n_vertices = total_counts;
6189 }
6190
6191 /* edges and faces */
6192 total_counts_cc = total_counts;
6193 for (ncc=0;ncc<n_ISForEdges+n_ISForFaces;ncc++) {
6194 IS used_is;
6195 PetscBool idxs_copied = PETSC_FALSE;
6196
6197 if (ncc<n_ISForEdges) {
6198 used_is = ISForEdges[ncc];
6199 boolforchange = pcbddc->use_change_of_basis; /* change or not the basis on the edge */
6200 } else {
6201 used_is = ISForFaces[ncc-n_ISForEdges];
6202 boolforchange = (PetscBool)(pcbddc->use_change_of_basis && pcbddc->use_change_on_faces); /* change or not the basis on the face */
6203 }
6204 temp_constraints = 0; /* zero the number of constraints I have on this conn comp */
6205
6206 ierr = ISGetSize(used_is,&size_of_constraint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6207 ierr = ISGetIndices(used_is,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6207,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6208 /* change of basis should not be performed on local periodic nodes */
6209 if (pcbddc->mat_graph->mirrors && pcbddc->mat_graph->mirrors[is_indices[0]]) boolforchange = PETSC_FALSE;
6210 if (nnsp_has_cnst) {
6211 PetscScalar quad_value;
6212
6213 ierr = PetscMemcpy(constraints_idxs + constraints_idxs_ptr[total_counts_cc],is_indices,size_of_constraint*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6214 idxs_copied = PETSC_TRUE;
6215
6216 if (!pcbddc->use_nnsp_true) {
6217 quad_value = (PetscScalar)(1.0/PetscSqrtReal((PetscReal)size_of_constraint)sqrt((PetscReal)size_of_constraint));
6218 } else {
6219 quad_value = 1.0;
6220 }
6221 for (j=0;j<size_of_constraint;j++) {
6222 constraints_data[constraints_data_ptr[total_counts_cc]+j] = quad_value;
6223 }
6224 temp_constraints++;
6225 total_counts++;
6226 }
6227 for (k=0;k<nnsp_size;k++) {
6228 PetscReal real_value;
6229 PetscScalar *ptr_to_data;
6230
6231 ierr = VecGetArrayRead(localnearnullsp[k],(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6232 ptr_to_data = &constraints_data[constraints_data_ptr[total_counts_cc]+temp_constraints*size_of_constraint];
6233 for (j=0;j<size_of_constraint;j++) {
6234 ptr_to_data[j] = array[is_indices[j]];
6235 }
6236 ierr = VecRestoreArrayRead(localnearnullsp[k],(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6236,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6237 /* check if array is null on the connected component */
6238 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6238,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6239 PetscStackCallBLAS("BLASasum",real_value = BLASasum_(&Blas_N,ptr_to_data,&Blas_one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASasum"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6239; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
real_value = dasum_(&Blas_N,ptr_to_data,&Blas_one); do
{ do {PetscErrorCode _7_ierr = PetscMallocValidate(6239,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6239,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6240 if (real_value > tol*size_of_constraint) { /* keep indices and values */
6241 temp_constraints++;
6242 total_counts++;
6243 if (!idxs_copied) {
6244 ierr = PetscMemcpy(constraints_idxs + constraints_idxs_ptr[total_counts_cc],is_indices,size_of_constraint*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6244,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6245 idxs_copied = PETSC_TRUE;
6246 }
6247 }
6248 }
6249 ierr = ISRestoreIndices(used_is,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6250 valid_constraints = temp_constraints;
6251 if (!pcbddc->use_nnsp_true && temp_constraints) {
6252 if (temp_constraints == 1) { /* just normalize the constraint */
6253 PetscScalar norm,*ptr_to_data;
6254
6255 ptr_to_data = &constraints_data[constraints_data_ptr[total_counts_cc]];
6256 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6257 PetscStackCallBLAS("BLASdot",norm = BLASdot_(&Blas_N,ptr_to_data,&Blas_one,ptr_to_data,&Blas_one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASdot"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6257; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
norm = ddot_(&Blas_N,ptr_to_data,&Blas_one,ptr_to_data
,&Blas_one); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(6257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6258 norm = 1.0/PetscSqrtReal(PetscRealPart(norm))sqrt((norm));
6259 PetscStackCallBLAS("BLASscal",BLASscal_(&Blas_N,&norm,ptr_to_data,&Blas_one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASscal"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6259; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dscal_(&Blas_N,&norm,ptr_to_data,&Blas_one); do {
do {PetscErrorCode _7_ierr = PetscMallocValidate(6259,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6260 } else { /* perform SVD */
6261 PetscScalar *ptr_to_data = &constraints_data[constraints_data_ptr[total_counts_cc]];
6262
6263#if defined(PETSC_MISSING_LAPACK_GESVD)
6264 /* SVD: Y = U*S*V^H -> U (eigenvectors of Y*Y^H) = Y*V*(S)^\dag
6265 POD: Y^H*Y = V*D*V^H, D = S^H*S -> U = Y*V*D^(-1/2)
6266 -> When PETSC_USE_COMPLEX and PETSC_MISSING_LAPACK_GESVD are defined
6267 the constraints basis will differ (by a complex factor with absolute value equal to 1)
6268 from that computed using LAPACKgesvd
6269 -> This is due to a different computation of eigenvectors in LAPACKheev
6270 -> The quality of the POD-computed basis will be the same */
6271 ierr = PetscMemzero(correlation_mat,temp_constraints*temp_constraints*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6271,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6272 /* Store upper triangular part of correlation matrix */
6273 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6274 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6274,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6275 for (j=0;j<temp_constraints;j++) {
6276 for (k=0;k<j+1;k++) {
6277 PetscStackCallBLAS("BLASdot",correlation_mat[j*temp_constraints+k] = BLASdot_(&Blas_N,ptr_to_data+k*size_of_constraint,&Blas_one,ptr_to_data+j*size_of_constraint,&Blas_one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASdot"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6277; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
correlation_mat[j*temp_constraints+k] = ddot_(&Blas_N,ptr_to_data
+k*size_of_constraint,&Blas_one,ptr_to_data+j*size_of_constraint
,&Blas_one); do { do {PetscErrorCode _7_ierr = PetscMallocValidate
(6277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6277,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6278 }
6279 }
6280 /* compute eigenvalues and eigenvectors of correlation matrix */
6281 ierr = PetscBLASIntCast(temp_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6281,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6282 ierr = PetscBLASIntCast(temp_constraints,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6282,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6283#if !defined(PETSC_USE_COMPLEX)
6284 PetscStackCallBLAS("LAPACKsyev",LAPACKsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals,work,&lwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsyev"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6284; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals
,work,&lwork,&lierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(6284,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6284,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6285#else
6286 PetscStackCallBLAS("LAPACKsyev",LAPACKsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals,work,&lwork,rwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKsyev"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6286; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dsyev_("V","U",&Blas_N,correlation_mat,&Blas_LDA,singular_vals
,work,&lwork,rwork,&lierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(6286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6287#endif
6288 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6289 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYEV Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6289,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYEV Lapack routine %d",(int
)lierr)
;
6290 /* retain eigenvalues greater than tol: note that LAPACKsyev gives eigs in ascending order */
6291 j = 0;
6292 while (j < temp_constraints && singular_vals[j]/singular_vals[temp_constraints-1] < tol) j++;
6293 total_counts = total_counts-j;
6294 valid_constraints = temp_constraints-j;
6295 /* scale and copy POD basis into used quadrature memory */
6296 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6297 ierr = PetscBLASIntCast(temp_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6298 ierr = PetscBLASIntCast(temp_constraints,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6299 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6299,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6300 ierr = PetscBLASIntCast(temp_constraints,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6300,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6301 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6302 if (j<temp_constraints) {
6303 PetscInt ii;
6304 for (k=j;k<temp_constraints;k++) singular_vals[k] = 1.0/PetscSqrtReal(singular_vals[k])sqrt(singular_vals[k]);
6305 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6305,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6306 PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&Blas_M,&Blas_N,&Blas_K,&one,ptr_to_data,&Blas_LDA,correlation_mat,&Blas_LDB,&zero,temp_basis,&Blas_LDC))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASgemm"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6306; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemm_("N","N",&Blas_M,&Blas_N,&Blas_K,&one,
ptr_to_data,&Blas_LDA,correlation_mat,&Blas_LDB,&
zero,temp_basis,&Blas_LDC); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(6306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6307 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6308 for (k=0;k<temp_constraints-j;k++) {
6309 for (ii=0;ii<size_of_constraint;ii++) {
6310 ptr_to_data[k*size_of_constraint+ii] = singular_vals[temp_constraints-1-k]*temp_basis[(temp_constraints-1-k)*size_of_constraint+ii];
6311 }
6312 }
6313 }
6314#else /* on missing GESVD */
6315 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6315,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6316 ierr = PetscBLASIntCast(temp_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6316,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6317 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6317,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6318 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6318,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6319#if !defined(PETSC_USE_COMPLEX)
6320 PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("O","N",&Blas_M,&Blas_N,ptr_to_data,&Blas_LDA,singular_vals,&dummy_scalar,&dummy_int,&dummy_scalar,&dummy_int,work,&lwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKgesvd"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6320; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgesvd_("O","N",&Blas_M,&Blas_N,ptr_to_data,&Blas_LDA
,singular_vals,&dummy_scalar,&dummy_int,&dummy_scalar
,&dummy_int,work,&lwork,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(6320,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6320,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6321#else
6322 PetscStackCallBLAS("LAPACKgesvd",LAPACKgesvd_("O","N",&Blas_M,&Blas_N,ptr_to_data,&Blas_LDA,singular_vals,&dummy_scalar,&dummy_int,&dummy_scalar,&dummy_int,work,&lwork,rwork,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKgesvd"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6322; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgesvd_("O","N",&Blas_M,&Blas_N,ptr_to_data,&Blas_LDA
,singular_vals,&dummy_scalar,&dummy_int,&dummy_scalar
,&dummy_int,work,&lwork,rwork,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(6322,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6322,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6323#endif
6324 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in GESVD Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6324,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in GESVD Lapack routine %d",(int
)lierr)
;
6325 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6325,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6326 /* retain eigenvalues greater than tol: note that LAPACKgesvd gives eigs in descending order */
6327 k = temp_constraints;
6328 if (k > size_of_constraint) k = size_of_constraint;
6329 j = 0;
6330 while (j < k && singular_vals[k-j-1]/singular_vals[0] < tol) j++;
6331 valid_constraints = k-j;
6332 total_counts = total_counts-temp_constraints+valid_constraints;
6333#endif /* on missing GESVD */
6334 }
6335 }
6336 /* update pointers information */
6337 if (valid_constraints) {
6338 constraints_n[total_counts_cc] = valid_constraints;
6339 constraints_idxs_ptr[total_counts_cc+1] = constraints_idxs_ptr[total_counts_cc]+size_of_constraint;
6340 constraints_data_ptr[total_counts_cc+1] = constraints_data_ptr[total_counts_cc]+size_of_constraint*valid_constraints;
6341 /* set change_of_basis flag */
6342 if (boolforchange) {
6343 PetscBTSet(change_basis,total_counts_cc);
6344 }
6345 total_counts_cc++;
6346 }
6347 }
6348 /* free workspace */
6349 if (!skip_lapack) {
6350 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),6350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6351#if defined(PETSC_USE_COMPLEX)
6352 ierr = PetscFree(rwork)((*PetscTrFree)((void*)(rwork),6352,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((rwork) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6352,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6353#endif
6354 ierr = PetscFree(singular_vals)((*PetscTrFree)((void*)(singular_vals),6354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((singular_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6355#if defined(PETSC_MISSING_LAPACK_GESVD)
6356 ierr = PetscFree(correlation_mat)((*PetscTrFree)((void*)(correlation_mat),6356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((correlation_mat) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6357 ierr = PetscFree(temp_basis)((*PetscTrFree)((void*)(temp_basis),6357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((temp_basis) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6358#endif
6359 }
6360 for (k=0;k<nnsp_size;k++) {
6361 ierr = VecDestroy(&localnearnullsp[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6361,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6362 }
6363 ierr = PetscFree(localnearnullsp)((*PetscTrFree)((void*)(localnearnullsp),6363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((localnearnullsp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6364 /* free index sets of faces, edges and vertices */
6365 for (i=0;i<n_ISForFaces;i++) {
6366 ierr = ISDestroy(&ISForFaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6366,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6367 }
6368 if (n_ISForFaces) {
6369 ierr = PetscFree(ISForFaces)((*PetscTrFree)((void*)(ISForFaces),6369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForFaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6370 }
6371 for (i=0;i<n_ISForEdges;i++) {
6372 ierr = ISDestroy(&ISForEdges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6372,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6373 }
6374 if (n_ISForEdges) {
6375 ierr = PetscFree(ISForEdges)((*PetscTrFree)((void*)(ISForEdges),6375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForEdges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6376 }
6377 ierr = ISDestroy(&ISForVertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6378 } else {
6379 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
6380
6381 total_counts = 0;
6382 n_vertices = 0;
6383 if (sub_schurs->is_vertices && pcbddc->use_vertices) {
6384 ierr = ISGetLocalSize(sub_schurs->is_vertices,&n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6385 }
6386 max_constraints = 0;
6387 total_counts_cc = 0;
6388 for (i=0;i<sub_schurs->n_subs+n_vertices;i++) {
6389 total_counts += pcbddc->adaptive_constraints_n[i];
6390 if (pcbddc->adaptive_constraints_n[i]) total_counts_cc++;
6391 max_constraints = PetscMax(max_constraints,pcbddc->adaptive_constraints_n[i])(((max_constraints)<(pcbddc->adaptive_constraints_n[i])
) ? (pcbddc->adaptive_constraints_n[i]) : (max_constraints
))
;
6392 }
6393 constraints_idxs_ptr = pcbddc->adaptive_constraints_idxs_ptr;
6394 constraints_data_ptr = pcbddc->adaptive_constraints_data_ptr;
6395 constraints_idxs = pcbddc->adaptive_constraints_idxs;
6396 constraints_data = pcbddc->adaptive_constraints_data;
6397 /* constraints_n differs from pcbddc->adaptive_constraints_n */
6398 ierr = PetscMalloc1(total_counts_cc,&constraints_n)PetscMallocA(1,PETSC_FALSE,6398,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(total_counts_cc)*sizeof(**(&constraints_n)),(&
constraints_n))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6398,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6399 total_counts_cc = 0;
6400 for (i=0;i<sub_schurs->n_subs+n_vertices;i++) {
6401 if (pcbddc->adaptive_constraints_n[i]) {
6402 constraints_n[total_counts_cc++] = pcbddc->adaptive_constraints_n[i];
6403 }
6404 }
6405
6406 max_size_of_constraint = 0;
6407 for (i=0;i<total_counts_cc;i++) max_size_of_constraint = PetscMax(max_size_of_constraint,constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i])(((max_size_of_constraint)<(constraints_idxs_ptr[i+1]-constraints_idxs_ptr
[i])) ? (constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i]) :
(max_size_of_constraint))
;
6408 ierr = PetscMalloc1(constraints_idxs_ptr[total_counts_cc],&constraints_idxs_B)PetscMallocA(1,PETSC_FALSE,6408,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(constraints_idxs_ptr[total_counts_cc])*sizeof(**(&
constraints_idxs_B)),(&constraints_idxs_B))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6408,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6409 /* Change of basis */
6410 ierr = PetscBTCreate(total_counts_cc,&change_basis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6410,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6411 if (pcbddc->use_change_of_basis) {
6412 for (i=0;i<sub_schurs->n_subs;i++) {
6413 if (PetscBTLookup(sub_schurs->is_edge,i) || pcbddc->use_change_on_faces) {
6414 ierr = PetscBTSet(change_basis,i+n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6414,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6415 }
6416 }
6417 }
6418 }
6419 pcbddc->local_primal_size = total_counts;
6420 ierr = PetscMalloc1(pcbddc->local_primal_size+pcbddc->benign_n,&pcbddc->primal_indices_local_idxs)PetscMallocA(1,PETSC_FALSE,6420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->local_primal_size+pcbddc->benign_n)*sizeof
(**(&pcbddc->primal_indices_local_idxs)),(&pcbddc->
primal_indices_local_idxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6421
6422 /* map constraints_idxs in boundary numbering */
6423 ierr = ISGlobalToLocalMappingApply(pcis->BtoNmap,IS_GTOLM_DROP,constraints_idxs_ptr[total_counts_cc],constraints_idxs,&i,constraints_idxs_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6423,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6424 if (i != constraints_idxs_ptr[total_counts_cc]) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error in boundary numbering for constraints indices %D != %D",constraints_idxs_ptr[total_counts_cc],i)return PetscError(((MPI_Comm)0x44000001),6424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error in boundary numbering for constraints indices %D != %D"
,constraints_idxs_ptr[total_counts_cc],i)
;
6425
6426 /* Create constraint matrix */
6427 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6427,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6428 ierr = MatSetType(pcbddc->ConstraintMatrix,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6429 ierr = MatSetSizes(pcbddc->ConstraintMatrix,pcbddc->local_primal_size,pcis->n,pcbddc->local_primal_size,pcis->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6430
6431 /* find primal_dofs: subdomain corners plus dofs selected as primal after change of basis */
6432 /* determine if a QR strategy is needed for change of basis */
6433 qr_needed = pcbddc->use_qr_single;
6434 ierr = PetscBTCreate(total_counts_cc,&qr_needed_idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6434,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6435 total_primal_vertices=0;
6436 pcbddc->local_primal_size_cc = 0;
6437 for (i=0;i<total_counts_cc;i++) {
6438 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6439 if (size_of_constraint == 1 && pcbddc->mat_graph->custom_minimal_size) {
6440 pcbddc->primal_indices_local_idxs[total_primal_vertices++] = constraints_idxs[constraints_idxs_ptr[i]];
6441 pcbddc->local_primal_size_cc += 1;
6442 } else if (PetscBTLookup(change_basis,i)) {
6443 for (k=0;k<constraints_n[i];k++) {
6444 pcbddc->primal_indices_local_idxs[total_primal_vertices++] = constraints_idxs[constraints_idxs_ptr[i]+k];
6445 }
6446 pcbddc->local_primal_size_cc += constraints_n[i];
6447 if (constraints_n[i] > 1 || pcbddc->use_qr_single) {
6448 PetscBTSet(qr_needed_idx,i);
6449 qr_needed = PETSC_TRUE;
6450 }
6451 } else {
6452 pcbddc->local_primal_size_cc += 1;
6453 }
6454 }
6455 /* note that the local variable n_vertices used below stores the number of pointwise constraints */
6456 pcbddc->n_vertices = total_primal_vertices;
6457 /* permute indices in order to have a sorted set of vertices */
6458 ierr = PetscSortInt(total_primal_vertices,pcbddc->primal_indices_local_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6458,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6459 ierr = PetscMalloc2(pcbddc->local_primal_size_cc+pcbddc->benign_n,&pcbddc->local_primal_ref_node,pcbddc->local_primal_size_cc+pcbddc->benign_n,&pcbddc->local_primal_ref_mult)PetscMallocA(2,PETSC_FALSE,6459,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->local_primal_size_cc+pcbddc->benign_n
)*sizeof(**(&pcbddc->local_primal_ref_node)),(&pcbddc
->local_primal_ref_node),(size_t)(pcbddc->local_primal_size_cc
+pcbddc->benign_n)*sizeof(**(&pcbddc->local_primal_ref_mult
)),(&pcbddc->local_primal_ref_mult))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6459,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6460 ierr = PetscMemcpy(pcbddc->local_primal_ref_node,pcbddc->primal_indices_local_idxs,total_primal_vertices*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6460,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6461 for (i=0;i<total_primal_vertices;i++) pcbddc->local_primal_ref_mult[i] = 1;
6462
6463 /* nonzero structure of constraint matrix */
6464 /* and get reference dof for local constraints */
6465 ierr = PetscMalloc1(pcbddc->local_primal_size,&nnz)PetscMallocA(1,PETSC_FALSE,6465,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->local_primal_size)*sizeof(**(&nnz)),
(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6465,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6466 for (i=0;i<total_primal_vertices;i++) nnz[i] = 1;
6467
6468 j = total_primal_vertices;
6469 total_counts = total_primal_vertices;
6470 cum = total_primal_vertices;
6471 for (i=n_vertices;i<total_counts_cc;i++) {
6472 if (!PetscBTLookup(change_basis,i)) {
6473 pcbddc->local_primal_ref_node[cum] = constraints_idxs[constraints_idxs_ptr[i]];
6474 pcbddc->local_primal_ref_mult[cum] = constraints_n[i];
6475 cum++;
6476 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6477 for (k=0;k<constraints_n[i];k++) {
6478 pcbddc->primal_indices_local_idxs[total_counts++] = constraints_idxs[constraints_idxs_ptr[i]+k];
6479 nnz[j+k] = size_of_constraint;
6480 }
6481 j += constraints_n[i];
6482 }
6483 }
6484 ierr = MatSeqAIJSetPreallocation(pcbddc->ConstraintMatrix,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6484,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6485 ierr = MatSetOption(pcbddc->ConstraintMatrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6486 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),6486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6487
6488 /* set values in constraint matrix */
6489 for (i=0;i<total_primal_vertices;i++) {
6490 ierr = MatSetValue(pcbddc->ConstraintMatrix,i,pcbddc->local_primal_ref_node[i],1.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6490,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6491 }
6492 total_counts = total_primal_vertices;
6493 for (i=n_vertices;i<total_counts_cc;i++) {
6494 if (!PetscBTLookup(change_basis,i)) {
6495 PetscInt *cols;
6496
6497 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6498 cols = constraints_idxs+constraints_idxs_ptr[i];
6499 for (k=0;k<constraints_n[i];k++) {
6500 PetscInt row = total_counts+k;
6501 PetscScalar *vals;
6502
6503 vals = constraints_data+constraints_data_ptr[i]+k*size_of_constraint;
6504 ierr = MatSetValues(pcbddc->ConstraintMatrix,1,&row,size_of_constraint,cols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6504,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6505 }
6506 total_counts += constraints_n[i];
6507 }
6508 }
6509 /* assembling */
6510 ierr = MatAssemblyBegin(pcbddc->ConstraintMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6511 ierr = MatAssemblyEnd(pcbddc->ConstraintMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6512 ierr = MatViewFromOptions(pcbddc->ConstraintMatrix,NULL((void*)0),"-pc_bddc_constraint_mat_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6513
6514 /* Create matrix for change of basis. We don't need it in case pcbddc->use_change_of_basis is FALSE */
6515 if (pcbddc->use_change_of_basis) {
6516 /* dual and primal dofs on a single cc */
6517 PetscInt dual_dofs,primal_dofs;
6518 /* working stuff for GEQRF */
6519 PetscScalar *qr_basis = NULL((void*)0),*qr_tau = NULL((void*)0),*qr_work = NULL((void*)0),lqr_work_t;
6520 PetscBLASInt lqr_work;
6521 /* working stuff for UNGQR */
6522 PetscScalar *gqr_work = NULL((void*)0),lgqr_work_t;
6523 PetscBLASInt lgqr_work;
6524 /* working stuff for TRTRS */
6525 PetscScalar *trs_rhs = NULL((void*)0);
6526 PetscBLASInt Blas_NRHS;
6527 /* pointers for values insertion into change of basis matrix */
6528 PetscInt *start_rows,*start_cols;
6529 PetscScalar *start_vals;
6530 /* working stuff for values insertion */
6531 PetscBT is_primal;
6532 PetscInt *aux_primal_numbering_B;
6533 /* matrix sizes */
6534 PetscInt global_size,local_size;
6535 /* temporary change of basis */
6536 Mat localChangeOfBasisMatrix;
6537 /* extra space for debugging */
6538 PetscScalar *dbg_work = NULL((void*)0);
6539
6540 /* local temporary change of basis acts on local interfaces -> dimension is n_B x n_B */
6541 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&localChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6542 ierr = MatSetType(localChangeOfBasisMatrix,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6542,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6543 ierr = MatSetSizes(localChangeOfBasisMatrix,pcis->n,pcis->n,pcis->n,pcis->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6543,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6544 /* nonzeros for local mat */
6545 ierr = PetscMalloc1(pcis->n,&nnz)PetscMallocA(1,PETSC_FALSE,6545,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcis->n)*sizeof(**(&nnz)),(&nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6545,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6546 if (!pcbddc->benign_change || pcbddc->fake_change) {
6547 for (i=0;i<pcis->n;i++) nnz[i]=1;
6548 } else {
6549 const PetscInt *ii;
6550 PetscInt n;
6551 PetscBool flg_row;
6552 ierr = MatGetRowIJ(pcbddc->benign_change,0,PETSC_FALSE,PETSC_FALSE,&n,&ii,NULL((void*)0),&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6553 for (i=0;i<n;i++) nnz[i] = ii[i+1]-ii[i];
6554 ierr = MatRestoreRowIJ(pcbddc->benign_change,0,PETSC_FALSE,PETSC_FALSE,&n,&ii,NULL((void*)0),&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6555 }
6556 for (i=n_vertices;i<total_counts_cc;i++) {
6557 if (PetscBTLookup(change_basis,i)) {
6558 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6559 if (PetscBTLookup(qr_needed_idx,i)) {
6560 for (j=0;j<size_of_constraint;j++) nnz[constraints_idxs[constraints_idxs_ptr[i]+j]] = size_of_constraint;
6561 } else {
6562 nnz[constraints_idxs[constraints_idxs_ptr[i]]] = size_of_constraint;
6563 for (j=1;j<size_of_constraint;j++) nnz[constraints_idxs[constraints_idxs_ptr[i]+j]] = 2;
6564 }
6565 }
6566 }
6567 ierr = MatSeqAIJSetPreallocation(localChangeOfBasisMatrix,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6567,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6568 ierr = MatSetOption(localChangeOfBasisMatrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6568,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6569 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),6569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6570 /* Set interior change in the matrix */
6571 if (!pcbddc->benign_change || pcbddc->fake_change) {
6572 for (i=0;i<pcis->n;i++) {
6573 ierr = MatSetValue(localChangeOfBasisMatrix,i,i,1.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6574 }
6575 } else {
6576 const PetscInt *ii,*jj;
6577 PetscScalar *aa;
6578 PetscInt n;
6579 PetscBool flg_row;
6580 ierr = MatGetRowIJ(pcbddc->benign_change,0,PETSC_FALSE,PETSC_FALSE,&n,&ii,&jj,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6580,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6581 ierr = MatSeqAIJGetArray(pcbddc->benign_change,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6581,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6582 for (i=0;i<n;i++) {
6583 ierr = MatSetValues(localChangeOfBasisMatrix,1,&i,ii[i+1]-ii[i],jj+ii[i],aa+ii[i],INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6584 }
6585 ierr = MatSeqAIJRestoreArray(pcbddc->benign_change,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6585,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6586 ierr = MatRestoreRowIJ(pcbddc->benign_change,0,PETSC_FALSE,PETSC_FALSE,&n,&ii,&jj,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6586,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6587 }
6588
6589 if (pcbddc->dbg_flag) {
6590 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"--------------------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6590,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6591 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Checking change of basis computation for subdomain %04d\n",PetscGlobalRank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6592 }
6593
6594
6595 /* Now we loop on the constraints which need a change of basis */
6596 /*
6597 Change of basis matrix is evaluated similarly to the FIRST APPROACH in
6598 Klawonn and Widlund, Dual-primal FETI-DP methods for linear elasticity, (see Sect 6.2.1)
6599
6600 Basic blocks of change of basis matrix T computed by
6601
6602 - Using the following block transformation if there is only a primal dof on the cc (and -pc_bddc_use_qr_single is not specified)
6603
6604 | 1 0 ... 0 s_1/S |
6605 | 0 1 ... 0 s_2/S |
6606 | ... |
6607 | 0 ... 1 s_{n-1}/S |
6608 | -s_1/s_n ... -s_{n-1}/s_n s_n/S |
6609
6610 with S = \sum_{i=1}^n s_i^2
6611 NOTE: in the above example, the primal dof is the last one of the edge in LOCAL ordering
6612 in the current implementation, the primal dof is the first one of the edge in GLOBAL ordering
6613
6614 - QR decomposition of constraints otherwise
6615 */
6616 if (qr_needed && max_size_of_constraint) {
6617 /* space to store Q */
6618 ierr = PetscMalloc1(max_size_of_constraint*max_size_of_constraint,&qr_basis)PetscMallocA(1,PETSC_FALSE,6618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(max_size_of_constraint*max_size_of_constraint)*sizeof
(**(&qr_basis)),(&qr_basis))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6618,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6619 /* array to store scaling factors for reflectors */
6620 ierr = PetscMalloc1(max_constraints,&qr_tau)PetscMallocA(1,PETSC_FALSE,6620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(max_constraints)*sizeof(**(&qr_tau)),(&qr_tau
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6621 /* first we issue queries for optimal work */
6622 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6622,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6623 ierr = PetscBLASIntCast(max_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6623,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6624 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6624,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6625 lqr_work = -1;
6626 PetscStackCallBLAS("LAPACKgeqrf",LAPACKgeqrf_(&Blas_M,&Blas_N,qr_basis,&Blas_LDA,qr_tau,&lqr_work_t,&lqr_work,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKgeqrf"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6626; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgeqrf_(&Blas_M,&Blas_N,qr_basis,&Blas_LDA,qr_tau
,&lqr_work_t,&lqr_work,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(6626,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6626,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6627 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to GEQRF Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6627,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to GEQRF Lapack routine %d"
,(int)lierr)
;
6628 ierr = PetscBLASIntCast((PetscInt)PetscRealPart(lqr_work_t)(lqr_work_t),&lqr_work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6628,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6629 ierr = PetscMalloc1((PetscInt)PetscRealPart(lqr_work_t),&qr_work)PetscMallocA(1,PETSC_FALSE,6629,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)((PetscInt)(lqr_work_t))*sizeof(**(&qr_work)),(&
qr_work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6629,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6630 lgqr_work = -1;
6631 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6631,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6632 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6632,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6633 ierr = PetscBLASIntCast(max_constraints,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6633,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6634 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6634,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6635 if (Blas_K>Blas_M) Blas_K=Blas_M; /* adjust just for computing optimal work */
6636 PetscStackCallBLAS("LAPACKorgqr",LAPACKorgqr_(&Blas_M,&Blas_N,&Blas_K,qr_basis,&Blas_LDA,qr_tau,&lgqr_work_t,&lgqr_work,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKorgqr"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6636; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dorgqr_(&Blas_M,&Blas_N,&Blas_K,qr_basis,&Blas_LDA
,qr_tau,&lgqr_work_t,&lgqr_work,&lierr); do { do {
PetscErrorCode _7_ierr = PetscMallocValidate(6636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6637 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to ORGQR/UNGQR Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6637,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to ORGQR/UNGQR Lapack routine %d"
,(int)lierr)
;
6638 ierr = PetscBLASIntCast((PetscInt)PetscRealPart(lgqr_work_t)(lgqr_work_t),&lgqr_work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6638,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6639 ierr = PetscMalloc1((PetscInt)PetscRealPart(lgqr_work_t),&gqr_work)PetscMallocA(1,PETSC_FALSE,6639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)((PetscInt)(lgqr_work_t))*sizeof(**(&gqr_work)),
(&gqr_work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6640 /* array to store rhs and solution of triangular solver */
6641 ierr = PetscMalloc1(max_constraints*max_constraints,&trs_rhs)PetscMallocA(1,PETSC_FALSE,6641,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(max_constraints*max_constraints)*sizeof(**(&trs_rhs
)),(&trs_rhs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6641,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6642 /* allocating workspace for check */
6643 if (pcbddc->dbg_flag) {
6644 ierr = PetscMalloc1(max_size_of_constraint*(max_constraints+max_size_of_constraint),&dbg_work)PetscMallocA(1,PETSC_FALSE,6644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(max_size_of_constraint*(max_constraints+max_size_of_constraint
))*sizeof(**(&dbg_work)),(&dbg_work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6644,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6645 }
6646 }
6647 /* array to store whether a node is primal or not */
6648 ierr = PetscBTCreate(pcis->n_B,&is_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6648,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6649 ierr = PetscMalloc1(total_primal_vertices,&aux_primal_numbering_B)PetscMallocA(1,PETSC_FALSE,6649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(total_primal_vertices)*sizeof(**(&aux_primal_numbering_B
)),(&aux_primal_numbering_B))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6649,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6650 ierr = ISGlobalToLocalMappingApply(pcis->BtoNmap,IS_GTOLM_DROP,total_primal_vertices,pcbddc->local_primal_ref_node,&i,aux_primal_numbering_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6650,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6651 if (i != total_primal_vertices) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Error in boundary numbering for BDDC vertices! %D != %D",total_primal_vertices,i)return PetscError(((MPI_Comm)0x44000001),6651,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error in boundary numbering for BDDC vertices! %D != %D"
,total_primal_vertices,i)
;
6652 for (i=0;i<total_primal_vertices;i++) {
6653 ierr = PetscBTSet(is_primal,aux_primal_numbering_B[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6653,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6654 }
6655 ierr = PetscFree(aux_primal_numbering_B)((*PetscTrFree)((void*)(aux_primal_numbering_B),6655,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((aux_primal_numbering_B) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6655,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6656
6657 /* loop on constraints and see whether or not they need a change of basis and compute it */
6658 for (total_counts=n_vertices;total_counts<total_counts_cc;total_counts++) {
6659 size_of_constraint = constraints_idxs_ptr[total_counts+1]-constraints_idxs_ptr[total_counts];
6660 if (PetscBTLookup(change_basis,total_counts)) {
6661 /* get constraint info */
6662 primal_dofs = constraints_n[total_counts];
6663 dual_dofs = size_of_constraint-primal_dofs;
6664
6665 if (pcbddc->dbg_flag) {
6666 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Constraints %D: %D need a change of basis (size %D)\n",total_counts,primal_dofs,size_of_constraint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6666,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6667 }
6668
6669 if (PetscBTLookup(qr_needed_idx,total_counts)) { /* QR */
6670
6671 /* copy quadrature constraints for change of basis check */
6672 if (pcbddc->dbg_flag) {
6673 ierr = PetscMemcpy(dbg_work,&constraints_data[constraints_data_ptr[total_counts]],size_of_constraint*primal_dofs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6674 }
6675 /* copy temporary constraints into larger work vector (in order to store all columns of Q) */
6676 ierr = PetscMemcpy(qr_basis,&constraints_data[constraints_data_ptr[total_counts]],size_of_constraint*primal_dofs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6677
6678 /* compute QR decomposition of constraints */
6679 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6679,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6680 ierr = PetscBLASIntCast(primal_dofs,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6680,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6681 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6682 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6682,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6683 PetscStackCallBLAS("LAPACKgeqrf",LAPACKgeqrf_(&Blas_M,&Blas_N,qr_basis,&Blas_LDA,qr_tau,qr_work,&lqr_work,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKgeqrf"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6683; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgeqrf_(&Blas_M,&Blas_N,qr_basis,&Blas_LDA,qr_tau
,qr_work,&lqr_work,&lierr); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(6683,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6683,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6684 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in GEQRF Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6684,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in GEQRF Lapack routine %d",(int
)lierr)
;
6685 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6685,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6686
6687 /* explictly compute R^-T */
6688 ierr = PetscMemzero(trs_rhs,primal_dofs*primal_dofs*sizeof(*trs_rhs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6689 for (j=0;j<primal_dofs;j++) trs_rhs[j*(primal_dofs+1)] = 1.0;
6690 ierr = PetscBLASIntCast(primal_dofs,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6690,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6691 ierr = PetscBLASIntCast(primal_dofs,&Blas_NRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6691,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6692 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6693 ierr = PetscBLASIntCast(primal_dofs,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6694 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6694,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6695 PetscStackCallBLAS("LAPACKtrtrs",LAPACKtrtrs_("U","T","N",&Blas_N,&Blas_NRHS,qr_basis,&Blas_LDA,trs_rhs,&Blas_LDB,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKtrtrs"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6695; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dtrtrs_("U","T","N",&Blas_N,&Blas_NRHS,qr_basis,&
Blas_LDA,trs_rhs,&Blas_LDB,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(6695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6696 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in TRTRS Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6696,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in TRTRS Lapack routine %d",(int
)lierr)
;
6697 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6698
6699 /* explicitly compute all columns of Q (Q = [Q1 | Q2] ) overwriting QR factorization in qr_basis */
6700 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6700,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6701 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6701,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6702 ierr = PetscBLASIntCast(primal_dofs,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6702,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6703 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6704 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6705 PetscStackCallBLAS("LAPACKorgqr",LAPACKorgqr_(&Blas_M,&Blas_N,&Blas_K,qr_basis,&Blas_LDA,qr_tau,gqr_work,&lgqr_work,&lierr))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "LAPACKorgqr"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6705; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dorgqr_(&Blas_M,&Blas_N,&Blas_K,qr_basis,&Blas_LDA
,qr_tau,gqr_work,&lgqr_work,&lierr); do { do {PetscErrorCode
_7_ierr = PetscMallocValidate(6705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6706 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in ORGQR/UNGQR Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in ORGQR/UNGQR Lapack routine %d"
,(int)lierr)
;
6707 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6707,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6708
6709 /* first primal_dofs columns of Q need to be re-scaled in order to be unitary w.r.t constraints
6710 i.e. C_{pxn}*Q_{nxn} should be equal to [I_pxp | 0_pxd] (see check below)
6711 where n=size_of_constraint, p=primal_dofs, d=dual_dofs (n=p+d), I and 0 identity and null matrix resp. */
6712 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6712,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6713 ierr = PetscBLASIntCast(primal_dofs,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6714 ierr = PetscBLASIntCast(primal_dofs,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6715 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6716 ierr = PetscBLASIntCast(primal_dofs,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6716,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6717 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6717,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6718 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6719 PetscStackCallBLAS("BLASgemm",BLASgemm_("N","N",&Blas_M,&Blas_N,&Blas_K,&one,qr_basis,&Blas_LDA,trs_rhs,&Blas_LDB,&zero,constraints_data+constraints_data_ptr[total_counts],&Blas_LDC))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASgemm"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6719; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemm_("N","N",&Blas_M,&Blas_N,&Blas_K,&one,
qr_basis,&Blas_LDA,trs_rhs,&Blas_LDB,&zero,constraints_data
+constraints_data_ptr[total_counts],&Blas_LDC); do { do {
PetscErrorCode _7_ierr = PetscMallocValidate(6719,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6719,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6720 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6720,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6721 ierr = PetscMemcpy(qr_basis,&constraints_data[constraints_data_ptr[total_counts]],size_of_constraint*primal_dofs*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6721,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6722
6723 /* insert values in change of basis matrix respecting global ordering of new primal dofs */
6724 start_rows = &constraints_idxs[constraints_idxs_ptr[total_counts]];
6725 /* insert cols for primal dofs */
6726 for (j=0;j<primal_dofs;j++) {
6727 start_vals = &qr_basis[j*size_of_constraint];
6728 start_cols = &constraints_idxs[constraints_idxs_ptr[total_counts]+j];
6729 ierr = MatSetValues(localChangeOfBasisMatrix,size_of_constraint,start_rows,1,start_cols,start_vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6729,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6730 }
6731 /* insert cols for dual dofs */
6732 for (j=0,k=0;j<dual_dofs;k++) {
6733 if (!PetscBTLookup(is_primal,constraints_idxs_B[constraints_idxs_ptr[total_counts]+k])) {
6734 start_vals = &qr_basis[(primal_dofs+j)*size_of_constraint];
6735 start_cols = &constraints_idxs[constraints_idxs_ptr[total_counts]+k];
6736 ierr = MatSetValues(localChangeOfBasisMatrix,size_of_constraint,start_rows,1,start_cols,start_vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6736,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6737 j++;
6738 }
6739 }
6740
6741 /* check change of basis */
6742 if (pcbddc->dbg_flag) {
6743 PetscInt ii,jj;
6744 PetscBool valid_qr=PETSC_TRUE;
6745 ierr = PetscBLASIntCast(primal_dofs,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6745,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6746 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6747 ierr = PetscBLASIntCast(size_of_constraint,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6748 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6749 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6750 ierr = PetscBLASIntCast(primal_dofs,&Blas_LDC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6751 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6751,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6752 PetscStackCallBLAS("BLASgemm",BLASgemm_("T","N",&Blas_M,&Blas_N,&Blas_K,&one,dbg_work,&Blas_LDA,qr_basis,&Blas_LDB,&zero,&dbg_work[size_of_constraint*primal_dofs],&Blas_LDC))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASgemm"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6752; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
dgemm_("T","N",&Blas_M,&Blas_N,&Blas_K,&one,
dbg_work,&Blas_LDA,qr_basis,&Blas_LDB,&zero,&
dbg_work[size_of_constraint*primal_dofs],&Blas_LDC); do {
do {PetscErrorCode _7_ierr = PetscMallocValidate(6752,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6753 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6753,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6754 for (jj=0;jj<size_of_constraint;jj++) {
6755 for (ii=0;ii<primal_dofs;ii++) {
6756 if (ii != jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]) > 1.e-12) valid_qr = PETSC_FALSE;
6757 if (ii == jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]-(PetscReal)1) > 1.e-12) valid_qr = PETSC_FALSE;
6758 }
6759 }
6760 if (!valid_qr) {
6761 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"\t-> wrong change of basis!\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6761,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6762 for (jj=0;jj<size_of_constraint;jj++) {
6763 for (ii=0;ii<primal_dofs;ii++) {
6764 if (ii != jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]) > 1.e-12) {
6765 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"\tQr basis function %D is not orthogonal to constraint %D (%1.14e)!\n",jj,ii,PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6765,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6766 }
6767 if (ii == jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]-(PetscReal)1) > 1.e-12) {
6768 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"\tQr basis function %D is not unitary w.r.t constraint %D (%1.14e)!\n",jj,ii,PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6768,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6769 }
6770 }
6771 }
6772 } else {
6773 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"\t-> right change of basis!\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6774 }
6775 }
6776 } else { /* simple transformation block */
6777 PetscInt row,col;
6778 PetscScalar val,norm;
6779
6780 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6780,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6781 PetscStackCallBLAS("BLASdot",norm = BLASdot_(&Blas_N,constraints_data+constraints_data_ptr[total_counts],&Blas_one,constraints_data+constraints_data_ptr[total_counts],&Blas_one))do { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = "BLASdot"; petscstack->file[petscstack->currentsize
] = "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6781; petscstack
->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
norm = ddot_(&Blas_N,constraints_data+constraints_data_ptr
[total_counts],&Blas_one,constraints_data+constraints_data_ptr
[total_counts],&Blas_one); do { do {PetscErrorCode _7_ierr
= PetscMallocValidate(6781,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6781,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.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)
;
6782 for (j=0;j<size_of_constraint;j++) {
6783 PetscInt row_B = constraints_idxs_B[constraints_idxs_ptr[total_counts]+j];
6784 row = constraints_idxs[constraints_idxs_ptr[total_counts]+j];
6785 if (!PetscBTLookup(is_primal,row_B)) {
6786 col = constraints_idxs[constraints_idxs_ptr[total_counts]];
6787 ierr = MatSetValue(localChangeOfBasisMatrix,row,row,1.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6787,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6788 ierr = MatSetValue(localChangeOfBasisMatrix,row,col,constraints_data[constraints_data_ptr[total_counts]+j]/norm,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6788,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6789 } else {
6790 for (k=0;k<size_of_constraint;k++) {
6791 col = constraints_idxs[constraints_idxs_ptr[total_counts]+k];
6792 if (row != col) {
6793 val = -constraints_data[constraints_data_ptr[total_counts]+k]/constraints_data[constraints_data_ptr[total_counts]];
6794 } else {
6795 val = constraints_data[constraints_data_ptr[total_counts]]/norm;
6796 }
6797 ierr = MatSetValue(localChangeOfBasisMatrix,row,col,val,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6797,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6798 }
6799 }
6800 }
6801 if (pcbddc->dbg_flag) {
6802 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"\t-> using standard change of basis\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6803 }
6804 }
6805 } else {
6806 if (pcbddc->dbg_flag) {
6807 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Constraint %D does not need a change of basis (size %D)\n",total_counts,size_of_constraint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6807,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6808 }
6809 }
6810 }
6811
6812 /* free workspace */
6813 if (qr_needed) {
6814 if (pcbddc->dbg_flag) {
6815 ierr = PetscFree(dbg_work)((*PetscTrFree)((void*)(dbg_work),6815,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((dbg_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6815,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6816 }
6817 ierr = PetscFree(trs_rhs)((*PetscTrFree)((void*)(trs_rhs),6817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((trs_rhs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6818 ierr = PetscFree(qr_tau)((*PetscTrFree)((void*)(qr_tau),6818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((qr_tau) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6819 ierr = PetscFree(qr_work)((*PetscTrFree)((void*)(qr_work),6819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((qr_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6820 ierr = PetscFree(gqr_work)((*PetscTrFree)((void*)(gqr_work),6820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((gqr_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6821 ierr = PetscFree(qr_basis)((*PetscTrFree)((void*)(qr_basis),6821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((qr_basis) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6821,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6822 }
6823 ierr = PetscBTDestroy(&is_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6824 ierr = MatAssemblyBegin(localChangeOfBasisMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6825 ierr = MatAssemblyEnd(localChangeOfBasisMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6826
6827 /* assembling of global change of variable */
6828 if (!pcbddc->fake_change) {
6829 Mat tmat;
6830 PetscInt bs;
6831
6832 ierr = VecGetSize(pcis->vec1_global,&global_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6832,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6833 ierr = VecGetLocalSize(pcis->vec1_global,&local_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6833,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6834 ierr = MatDuplicate(pc->pmat,MAT_DO_NOT_COPY_VALUES,&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6835 ierr = MatISSetLocalMat(tmat,localChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6836 ierr = MatAssemblyBegin(tmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6836,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6837 ierr = MatAssemblyEnd(tmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6837,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6838 ierr = MatCreate(PetscObjectComm((PetscObject)pc),&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6838,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6839 ierr = MatSetType(pcbddc->ChangeOfBasisMatrix,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6839,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6840 ierr = MatGetBlockSize(pc->pmat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6840,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6841 ierr = MatSetBlockSize(pcbddc->ChangeOfBasisMatrix,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6841,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6842 ierr = MatSetSizes(pcbddc->ChangeOfBasisMatrix,local_size,local_size,global_size,global_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6842,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6843 ierr = MatISSetMPIXAIJPreallocation_Private(tmat,pcbddc->ChangeOfBasisMatrix,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6843,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6844 ierr = MatConvert(tmat,MATAIJ"aij",MAT_REUSE_MATRIX,&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6844,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6845 ierr = MatDestroy(&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6845,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6846 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6846,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6847 ierr = VecSet(pcis->vec1_N,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6847,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6848 ierr = VecScatterBegin(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6848,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6849 ierr = VecScatterEnd(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6849,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6850 ierr = VecReciprocal(pcis->vec1_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6850,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6851 ierr = MatDiagonalScale(pcbddc->ChangeOfBasisMatrix,pcis->vec1_global,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6851,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6852
6853 /* check */
6854 if (pcbddc->dbg_flag) {
6855 PetscReal error;
6856 Vec x,x_change;
6857
6858 ierr = VecDuplicate(pcis->vec1_global,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6859 ierr = VecDuplicate(pcis->vec1_global,&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6860 ierr = VecSetRandom(x,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6861 ierr = VecCopy(x,pcis->vec1_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6862 ierr = VecScatterBegin(matis->rctx,x,pcis->vec1_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6862,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6863 ierr = VecScatterEnd(matis->rctx,x,pcis->vec1_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6863,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6864 ierr = MatMult(localChangeOfBasisMatrix,pcis->vec1_N,pcis->vec2_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6864,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6865 ierr = VecScatterBegin(matis->rctx,pcis->vec2_N,x,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6866 ierr = VecScatterEnd(matis->rctx,pcis->vec2_N,x,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6867 ierr = MatMult(pcbddc->ChangeOfBasisMatrix,pcis->vec1_global,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6868 ierr = VecAXPY(x,-1.0,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6869 ierr = VecNorm(x,NORM_INFINITY,&error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6870 if (error > PETSC_SMALL1.e-10) {
6871 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"Error global vs local change on N: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),6871,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error global vs local change on N: %1.6e"
,error)
;
6872 }
6873 ierr = VecDestroy(&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6874 ierr = VecDestroy(&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6875 }
6876 /* adapt sub_schurs computed (if any) */
6877 if (pcbddc->use_deluxe_scaling) {
6878 PCBDDCSubSchurs sub_schurs=pcbddc->sub_schurs;
6879
6880 if (pcbddc->use_change_of_basis && pcbddc->adaptive_userdefined) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_SUP,"Cannot mix automatic change of basis, adaptive selection and user-defined constraints")return PetscError(PetscObjectComm((PetscObject)pc),6880,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot mix automatic change of basis, adaptive selection and user-defined constraints"
)
;
6881 if (sub_schurs && sub_schurs->S_Ej_all) {
6882 Mat S_new,tmat;
6883 IS is_all_N,is_V_Sall = NULL((void*)0);
6884
6885 ierr = ISLocalToGlobalMappingApplyIS(pcis->BtoNmap,sub_schurs->is_Ej_all,&is_all_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6886 ierr = MatCreateSubMatrix(localChangeOfBasisMatrix,is_all_N,is_all_N,MAT_INITIAL_MATRIX,&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6886,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6887 if (pcbddc->deluxe_zerorows) {
6888 ISLocalToGlobalMapping NtoSall;
6889 IS is_V;
6890 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->n_vertices,pcbddc->local_primal_ref_node,PETSC_COPY_VALUES,&is_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6890,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6891 ierr = ISLocalToGlobalMappingCreateIS(is_all_N,&NtoSall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6891,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6892 ierr = ISGlobalToLocalMappingApplyIS(NtoSall,IS_GTOLM_DROP,is_V,&is_V_Sall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6892,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6893 ierr = ISLocalToGlobalMappingDestroy(&NtoSall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6893,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6894 ierr = ISDestroy(&is_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6894,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6895 }
6896 ierr = ISDestroy(&is_all_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6897 ierr = MatPtAP(sub_schurs->S_Ej_all,tmat,MAT_INITIAL_MATRIX,1.0,&S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6898 ierr = MatDestroy(&sub_schurs->S_Ej_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6898,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6899 ierr = PetscObjectReference((PetscObject)S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6899,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6900 if (pcbddc->deluxe_zerorows) {
6901 const PetscScalar *array;
6902 const PetscInt *idxs_V,*idxs_all;
6903 PetscInt i,n_V;
6904
6905 ierr = MatZeroRowsColumnsIS(S_new,is_V_Sall,1.,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6905,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6906 ierr = ISGetLocalSize(is_V_Sall,&n_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6906,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6907 ierr = ISGetIndices(is_V_Sall,&idxs_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6907,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6908 ierr = ISGetIndices(sub_schurs->is_Ej_all,&idxs_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6908,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6909 ierr = VecGetArrayRead(pcis->D,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6910 for (i=0;i<n_V;i++) {
6911 PetscScalar val;
6912 PetscInt idx;
6913
6914 idx = idxs_V[i];
6915 val = array[idxs_all[idxs_V[i]]];
6916 ierr = MatSetValue(S_new,idx,idx,val,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6916,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6917 }
6918 ierr = MatAssemblyBegin(S_new,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6918,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6919 ierr = MatAssemblyEnd(S_new,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6919,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6920 ierr = VecRestoreArrayRead(pcis->D,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6921 ierr = ISRestoreIndices(sub_schurs->is_Ej_all,&idxs_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6922 ierr = ISRestoreIndices(is_V_Sall,&idxs_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6922,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6923 }
6924 sub_schurs->S_Ej_all = S_new;
6925 ierr = MatDestroy(&S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6925,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6926 if (sub_schurs->sum_S_Ej_all) {
6927 ierr = MatPtAP(sub_schurs->sum_S_Ej_all,tmat,MAT_INITIAL_MATRIX,1.0,&S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6927,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6928 ierr = MatDestroy(&sub_schurs->sum_S_Ej_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6928,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6929 ierr = PetscObjectReference((PetscObject)S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6929,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6930 if (pcbddc->deluxe_zerorows) {
6931 ierr = MatZeroRowsColumnsIS(S_new,is_V_Sall,1.,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6931,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6932 }
6933 sub_schurs->sum_S_Ej_all = S_new;
6934 ierr = MatDestroy(&S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6935 }
6936 ierr = ISDestroy(&is_V_Sall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6936,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6937 ierr = MatDestroy(&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6937,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6938 }
6939 /* destroy any change of basis context in sub_schurs */
6940 if (sub_schurs && sub_schurs->change) {
6941 PetscInt i;
6942
6943 for (i=0;i<sub_schurs->n_subs;i++) {
6944 ierr = KSPDestroy(&sub_schurs->change[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6945 }
6946 ierr = PetscFree(sub_schurs->change)((*PetscTrFree)((void*)(sub_schurs->change),6946,__func__,
"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((sub_schurs->change) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6946,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6947 }
6948 }
6949 if (pcbddc->switch_static) { /* need to save the local change */
6950 pcbddc->switch_static_change = localChangeOfBasisMatrix;
6951 } else {
6952 ierr = MatDestroy(&localChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6952,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6953 }
6954 /* determine if any process has changed the pressures locally */
6955 pcbddc->change_interior = pcbddc->benign_have_null;
6956 } else { /* fake change (get back change of basis into ConstraintMatrix and info on qr) */
6957 ierr = MatDestroy(&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6957,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6958 pcbddc->ConstraintMatrix = localChangeOfBasisMatrix;
6959 pcbddc->use_qr_single = qr_needed;
6960 }
6961 } else if (pcbddc->user_ChangeOfBasisMatrix || pcbddc->benign_saddle_point) {
6962 if (!pcbddc->benign_have_null && pcbddc->user_ChangeOfBasisMatrix) {
6963 ierr = PetscObjectReference((PetscObject)pcbddc->user_ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6964 pcbddc->ChangeOfBasisMatrix = pcbddc->user_ChangeOfBasisMatrix;
6965 } else {
6966 Mat benign_global = NULL((void*)0);
6967 if (pcbddc->benign_have_null) {
6968 Mat M;
6969
6970 pcbddc->change_interior = PETSC_TRUE;
6971 ierr = VecCopy(matis->counter,pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6972 ierr = VecReciprocal(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6973 ierr = MatDuplicate(pc->pmat,MAT_DO_NOT_COPY_VALUES,&benign_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6974 if (pcbddc->benign_change) {
6975 ierr = MatDuplicate(pcbddc->benign_change,MAT_COPY_VALUES,&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6976 ierr = MatDiagonalScale(M,pcis->vec1_N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6976,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6977 } else {
6978 ierr = MatCreateSeqAIJ(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcis->n,pcis->n,1,NULL((void*)0),&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6979 ierr = MatDiagonalSet(M,pcis->vec1_N,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6979,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6980 }
6981 ierr = MatISSetLocalMat(benign_global,M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6982 ierr = MatDestroy(&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6982,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6983 ierr = MatAssemblyBegin(benign_global,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6983,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6984 ierr = MatAssemblyEnd(benign_global,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6984,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6985 }
6986 if (pcbddc->user_ChangeOfBasisMatrix) {
6987 ierr = MatMatMult(pcbddc->user_ChangeOfBasisMatrix,benign_global,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6987,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6988 ierr = MatDestroy(&benign_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6988,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6989 } else if (pcbddc->benign_have_null) {
6990 pcbddc->ChangeOfBasisMatrix = benign_global;
6991 }
6992 }
6993 if (pcbddc->switch_static && pcbddc->ChangeOfBasisMatrix) { /* need to save the local change */
6994 IS is_global;
6995 const PetscInt *gidxs;
6996
6997 ierr = ISLocalToGlobalMappingGetIndices(pc->pmat->rmap->mapping,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6997,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6998 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),pcis->n,gidxs,PETSC_COPY_VALUES,&is_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6998,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6999 ierr = ISLocalToGlobalMappingRestoreIndices(pc->pmat->rmap->mapping,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6999,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7000 ierr = MatCreateSubMatrixUnsorted(pcbddc->ChangeOfBasisMatrix,is_global,is_global,&pcbddc->switch_static_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7000,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7001 ierr = ISDestroy(&is_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7001,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7002 }
7003 }
7004 if (!pcbddc->fake_change && pcbddc->ChangeOfBasisMatrix && !pcbddc->work_change) {
7005 ierr = VecDuplicate(pcis->vec1_global,&pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7005,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7006 }
7007
7008 if (!pcbddc->fake_change) {
7009 /* add pressure dofs to set of primal nodes for numbering purposes */
7010 for (i=0;i<pcbddc->benign_n;i++) {
7011 pcbddc->local_primal_ref_node[pcbddc->local_primal_size_cc] = pcbddc->benign_p0_lidx[i];
7012 pcbddc->primal_indices_local_idxs[pcbddc->local_primal_size] = pcbddc->benign_p0_lidx[i];
7013 pcbddc->local_primal_ref_mult[pcbddc->local_primal_size_cc] = 1;
7014 pcbddc->local_primal_size_cc++;
7015 pcbddc->local_primal_size++;
7016 }
7017
7018 /* check if a new primal space has been introduced (also take into account benign trick) */
7019 pcbddc->new_primal_space_local = PETSC_TRUE;
7020 if (olocal_primal_size == pcbddc->local_primal_size) {
7021 ierr = PetscMemcmp(pcbddc->local_primal_ref_node,olocal_primal_ref_node,olocal_primal_size_cc*sizeof(PetscInt),&pcbddc->new_primal_space_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7021,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7022 pcbddc->new_primal_space_local = (PetscBool)(!pcbddc->new_primal_space_local);
7023 if (!pcbddc->new_primal_space_local) {
7024 ierr = PetscMemcmp(pcbddc->local_primal_ref_mult,olocal_primal_ref_mult,olocal_primal_size_cc*sizeof(PetscInt),&pcbddc->new_primal_space_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7024,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7025 pcbddc->new_primal_space_local = (PetscBool)(!pcbddc->new_primal_space_local);
7026 }
7027 }
7028 /* new_primal_space will be used for numbering of coarse dofs, so it should be the same across all subdomains */
7029 ierr = MPIU_Allreduce(&pcbddc->new_primal_space_local,&pcbddc->new_primal_space,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,7029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&pcbddc->new_primal_space_local
),(&pcbddc->new_primal_space),(1),(MPIU_BOOL),((MPI_Op
)(0x58000007)),(PetscObjectComm((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7030 }
7031 ierr = PetscFree2(olocal_primal_ref_node,olocal_primal_ref_mult)PetscFreeA(2,7031,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(olocal_primal_ref_node),&(olocal_primal_ref_mult))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7031,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7032
7033 /* flush dbg viewer */
7034 if (pcbddc->dbg_flag) {
7035 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7035,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7036 }
7037
7038 /* free workspace */
7039 ierr = PetscBTDestroy(&qr_needed_idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7039,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7040 ierr = PetscBTDestroy(&change_basis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7040,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7041 if (!pcbddc->adaptive_selection) {
7042 ierr = PetscFree3(constraints_idxs_ptr,constraints_data_ptr,constraints_n)PetscFreeA(3,7042,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(constraints_idxs_ptr),&(constraints_data_ptr),&
(constraints_n))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7042,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7043 ierr = PetscFree3(constraints_data,constraints_idxs,constraints_idxs_B)PetscFreeA(3,7043,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(constraints_data),&(constraints_idxs),&(constraints_idxs_B
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7043,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7044 } else {
7045 ierr = PetscFree5(pcbddc->adaptive_constraints_n,PetscFreeA(5,7049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->adaptive_constraints_n),&(pcbddc->adaptive_constraints_idxs_ptr
),&(pcbddc->adaptive_constraints_data_ptr),&(pcbddc
->adaptive_constraints_idxs),&(pcbddc->adaptive_constraints_data
))
7046 pcbddc->adaptive_constraints_idxs_ptr,PetscFreeA(5,7049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->adaptive_constraints_n),&(pcbddc->adaptive_constraints_idxs_ptr
),&(pcbddc->adaptive_constraints_data_ptr),&(pcbddc
->adaptive_constraints_idxs),&(pcbddc->adaptive_constraints_data
))
7047 pcbddc->adaptive_constraints_data_ptr,PetscFreeA(5,7049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->adaptive_constraints_n),&(pcbddc->adaptive_constraints_idxs_ptr
),&(pcbddc->adaptive_constraints_data_ptr),&(pcbddc
->adaptive_constraints_idxs),&(pcbddc->adaptive_constraints_data
))
7048 pcbddc->adaptive_constraints_idxs,PetscFreeA(5,7049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->adaptive_constraints_n),&(pcbddc->adaptive_constraints_idxs_ptr
),&(pcbddc->adaptive_constraints_data_ptr),&(pcbddc
->adaptive_constraints_idxs),&(pcbddc->adaptive_constraints_data
))
7049 pcbddc->adaptive_constraints_data)PetscFreeA(5,7049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddc->adaptive_constraints_n),&(pcbddc->adaptive_constraints_idxs_ptr
),&(pcbddc->adaptive_constraints_data_ptr),&(pcbddc
->adaptive_constraints_idxs),&(pcbddc->adaptive_constraints_data
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7050 ierr = PetscFree(constraints_n)((*PetscTrFree)((void*)(constraints_n),7050,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((constraints_n) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7050,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7051 ierr = PetscFree(constraints_idxs_B)((*PetscTrFree)((void*)(constraints_idxs_B),7051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((constraints_idxs_B) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7052 }
7053 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7054}
7055/* #undef PETSC_MISSING_LAPACK_GESVD */
7056
7057PetscErrorCode PCBDDCAnalyzeInterface(PC pc)
7058{
7059 ISLocalToGlobalMapping map;
7060 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
7061 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
7062 PetscInt i,N;
7063 PetscBool rcsr = PETSC_FALSE;
7064 PetscErrorCode ierr;
7065
7066 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7066; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7067 if (pcbddc->recompute_topography) {
7068 pcbddc->graphanalyzed = PETSC_FALSE;
7069 /* Reset previously computed graph */
7070 ierr = PCBDDCGraphReset(pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7071 /* Init local Graph struct */
7072 ierr = MatGetSize(pc->pmat,&N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7073 ierr = MatGetLocalToGlobalMapping(pc->pmat,&map,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7073,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7074 ierr = PCBDDCGraphInit(pcbddc->mat_graph,map,N,pcbddc->graphmaxcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7074,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7075
7076 if (pcbddc->user_primal_vertices_local && !pcbddc->user_primal_vertices) {
7077 ierr = PCBDDCConsistencyCheckIS(pc,MPI_LOR(MPI_Op)(0x58000007),&pcbddc->user_primal_vertices_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7078 }
7079 /* Check validity of the csr graph passed in by the user */
7080 if (pcbddc->mat_graph->nvtxs_csr && pcbddc->mat_graph->nvtxs_csr != pcbddc->mat_graph->nvtxs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Invalid size of local CSR graph! Found %D, expected %D",pcbddc->mat_graph->nvtxs_csr,pcbddc->mat_graph->nvtxs)return PetscError(((MPI_Comm)0x44000001),7080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Invalid size of local CSR graph! Found %D, expected %D"
,pcbddc->mat_graph->nvtxs_csr,pcbddc->mat_graph->
nvtxs)
;
7081
7082 /* Set default CSR adjacency of local dofs if not provided by the user with PCBDDCSetLocalAdjacencyGraph */
7083 if (!pcbddc->mat_graph->xadj && pcbddc->use_local_adj) {
7084 PetscInt *xadj,*adjncy;
7085 PetscInt nvtxs;
7086 PetscBool flg_row=PETSC_FALSE;
7087
7088 ierr = MatGetRowIJ(matis->A,0,PETSC_TRUE,PETSC_FALSE,&nvtxs,(const PetscInt**)&xadj,(const PetscInt**)&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7088,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7089 if (flg_row) {
7090 ierr = PCBDDCSetLocalAdjacencyGraph(pc,nvtxs,xadj,adjncy,PETSC_COPY_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7090,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7091 pcbddc->computed_rowadj = PETSC_TRUE;
7092 }
7093 ierr = MatRestoreRowIJ(matis->A,0,PETSC_TRUE,PETSC_FALSE,&nvtxs,(const PetscInt**)&xadj,(const PetscInt**)&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7094 rcsr = PETSC_TRUE;
7095 }
7096 if (pcbddc->dbg_flag) {
7097 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7097,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7098 }
7099
7100 if (pcbddc->mat_graph->cdim && !pcbddc->mat_graph->cloc) {
7101 PetscReal *lcoords;
7102 PetscInt n;
7103 MPI_Datatype dimrealtype;
7104
7105 /* TODO: support for blocked */
7106 if (pcbddc->mat_graph->cnloc != pc->pmat->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_USER,"Invalid number of local coordinates! Got %D, expected %D",pcbddc->mat_graph->cnloc,pc->pmat->rmap->n)return PetscError(((MPI_Comm)0x44000001),7106,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Invalid number of local coordinates! Got %D, expected %D"
,pcbddc->mat_graph->cnloc,pc->pmat->rmap->n)
;
7107 ierr = MatGetLocalSize(matis->A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7107,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7108 ierr = PetscMalloc1(pcbddc->mat_graph->cdim*n,&lcoords)PetscMallocA(1,PETSC_FALSE,7108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->mat_graph->cdim*n)*sizeof(**(&lcoords
)),(&lcoords))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7108,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7109 ierr = MPI_Type_contiguous(pcbddc->mat_graph->cdim,MPIU_REAL((MPI_Datatype)0x4c00080b),&dimrealtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7109,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7110 ierr = MPI_Type_commit(&dimrealtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7110,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7111 ierr = PetscSFBcastBegin(matis->sf,dimrealtype,pcbddc->mat_graph->coords,lcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7111,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7112 ierr = PetscSFBcastEnd(matis->sf,dimrealtype,pcbddc->mat_graph->coords,lcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7112,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7113 ierr = MPI_Type_free(&dimrealtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7114 ierr = PetscFree(pcbddc->mat_graph->coords)((*PetscTrFree)((void*)(pcbddc->mat_graph->coords),7114
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->mat_graph->coords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7115
7116 pcbddc->mat_graph->coords = lcoords;
7117 pcbddc->mat_graph->cloc = PETSC_TRUE;
7118 pcbddc->mat_graph->cnloc = n;
7119 }
7120 if (pcbddc->mat_graph->cnloc && pcbddc->mat_graph->cnloc != pcbddc->mat_graph->nvtxs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_USER,"Invalid number of local subdomain coordinates! Got %D, expected %D",pcbddc->mat_graph->cnloc,pcbddc->mat_graph->nvtxs)return PetscError(((MPI_Comm)0x44000001),7120,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Invalid number of local subdomain coordinates! Got %D, expected %D"
,pcbddc->mat_graph->cnloc,pcbddc->mat_graph->nvtxs
)
;
7121 pcbddc->mat_graph->active_coords = (PetscBool)(pcbddc->corner_selection && !pcbddc->corner_selected);
7122
7123 /* Setup of Graph */
7124 pcbddc->mat_graph->commsizelimit = 0; /* don't use the COMM_SELF variant of the graph */
7125 ierr = PCBDDCGraphSetUp(pcbddc->mat_graph,pcbddc->vertex_size,pcbddc->NeumannBoundariesLocal,pcbddc->DirichletBoundariesLocal,pcbddc->n_ISForDofsLocal,pcbddc->ISForDofsLocal,pcbddc->user_primal_vertices_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7125,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7126
7127 /* attach info on disconnected subdomains if present */
7128 if (pcbddc->n_local_subs) {
7129 PetscInt *local_subs,n,totn;
7130
7131 ierr = MatGetLocalSize(matis->A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7132 ierr = PetscMalloc1(n,&local_subs)PetscMallocA(1,PETSC_FALSE,7132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&local_subs)),(&local_subs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7133 for (i=0;i<n;i++) local_subs[i] = pcbddc->n_local_subs;
7134 for (i=0;i<pcbddc->n_local_subs;i++) {
7135 const PetscInt *idxs;
7136 PetscInt nl,j;
7137
7138 ierr = ISGetLocalSize(pcbddc->local_subs[i],&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7138,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7139 ierr = ISGetIndices(pcbddc->local_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7139,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7140 for (j=0;j<nl;j++) local_subs[idxs[j]] = i;
7141 ierr = ISRestoreIndices(pcbddc->local_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7141,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7142 }
7143 for (i=0,totn=0;i<n;i++) totn = PetscMax(totn,local_subs[i])(((totn)<(local_subs[i])) ? (local_subs[i]) : (totn));
7144 pcbddc->mat_graph->n_local_subs = totn + 1;
7145 pcbddc->mat_graph->local_subs = local_subs;
7146 }
7147 }
7148
7149 if (!pcbddc->graphanalyzed) {
7150 /* Graph's connected components analysis */
7151 ierr = PCBDDCGraphComputeConnectedComponents(pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7151,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7152 pcbddc->graphanalyzed = PETSC_TRUE;
7153 pcbddc->corner_selected = pcbddc->corner_selection;
7154 }
7155 if (rcsr) pcbddc->mat_graph->nvtxs_csr = 0;
7156 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7157}
7158
7159PetscErrorCode PCBDDCOrthonormalizeVecs(PetscInt n, Vec vecs[])
7160{
7161 PetscInt i,j;
7162 PetscScalar *alphas;
7163 PetscReal norm;
7164 PetscErrorCode ierr;
7165
7166 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7166; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7167 if (!n) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7168 ierr = PetscMalloc1(n,&alphas)PetscMallocA(1,PETSC_FALSE,7168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&alphas)),(&alphas))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7169 ierr = VecNormalize(vecs[0],&norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7169,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7170 if (norm < PETSC_SMALL1.e-10) {
7171 ierr = VecSet(vecs[0],0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7171,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7172 }
7173 for (i=1;i<n;i++) {
7174 ierr = VecMDot(vecs[i],i,vecs,alphas);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7175 for (j=0;j<i;j++) alphas[j] = PetscConj(-alphas[j])(-alphas[j]);
7176 ierr = VecMAXPY(vecs[i],i,alphas,vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7176,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7177 ierr = VecNormalize(vecs[i],&norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7177,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7178 if (norm < PETSC_SMALL1.e-10) {
7179 ierr = VecSet(vecs[i],0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7180 }
7181 }
7182 ierr = PetscFree(alphas)((*PetscTrFree)((void*)(alphas),7182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((alphas) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7183 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7184}
7185
7186PetscErrorCode PCBDDCMatISGetSubassemblingPattern(Mat mat, PetscInt *n_subdomains, PetscInt redprocs, IS* is_sends, PetscBool *have_void)
7187{
7188 Mat A;
7189 PetscInt n_neighs,*neighs,*n_shared,**shared;
7190 PetscMPIInt size,rank,color;
7191 PetscInt *xadj,*adjncy;
7192 PetscInt *adjncy_wgt,*v_wgt,*ranks_send_to_idx;
7193 PetscInt im_active,active_procs,N,n,i,j,threshold = 2;
7194 PetscInt void_procs,*procs_candidates = NULL((void*)0);
7195 PetscInt xadj_count,*count;
7196 PetscBool ismatis,use_vwgt=PETSC_FALSE;
7197 PetscSubcomm psubcomm;
7198 MPI_Comm subcomm;
7199 PetscErrorCode ierr;
7200
7201 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7201; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7202 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),7202,
__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),7202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),7202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7202,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
7203 ierr = PetscObjectTypeCompare((PetscObject)mat,MATIS"is",&ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7203,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7204 if (!ismatis) SETERRQ1(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Cannot use %s on a matrix object which is not of type MATIS",PETSC_FUNCTION_NAME)return PetscError(PetscObjectComm((PetscObject)mat),7204,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot use %s on a matrix object which is not of type MATIS"
,__func__)
;
7205 PetscValidLogicalCollectiveInt(mat,*n_subdomains,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -*
n_subdomains; b1[1] = *n_subdomains; _7_ierr = (PetscAllreduceBarrierCheck
(PetscObjectComm((PetscObject)mat),2,7205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7205
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
7206 PetscValidLogicalCollectiveInt(mat,redprocs,3)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -redprocs
; b1[1] = redprocs; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)mat),2,7206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7206
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,3); } while (0)
;
7207 if (*n_subdomains <=0) SETERRQ1(PetscObjectComm((PetscObject)mat),PETSC_ERR_ARG_WRONG,"Invalid number of subdomains requested %D",*n_subdomains)return PetscError(PetscObjectComm((PetscObject)mat),7207,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Invalid number of subdomains requested %D"
,*n_subdomains)
;
7208
7209 if (have_void) *have_void = PETSC_FALSE;
7210 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)mat),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7210,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7211 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7211,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7212 ierr = MatISGetLocalMat(mat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7212,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7213 ierr = MatGetLocalSize(A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7214 im_active = !!n;
7215 ierr = MPIU_Allreduce(&im_active,&active_procs,1,MPIU_INT,MPI_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,1,7215,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((&im_active),(&
active_procs),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000003
)),(PetscObjectComm((PetscObject)mat)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7215,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7216 void_procs = size - active_procs;
7217 /* get ranks of of non-active processes in mat communicator */
7218 if (void_procs) {
7219 PetscInt ncand;
7220
7221 if (have_void) *have_void = PETSC_TRUE;
7222 ierr = PetscMalloc1(size,&procs_candidates)PetscMallocA(1,PETSC_FALSE,7222,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(size)*sizeof(**(&procs_candidates)),(&procs_candidates
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7222,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7223 ierr = MPI_Allgather(&im_active,1,MPIU_INT,procs_candidates,1,MPIU_INT,PetscObjectComm((PetscObject)mat))((petsc_gather_ct += PetscMPIParallelComm((PetscObjectComm((PetscObject
)mat))),0) || MPI_Allgather((&im_active),(1),(((MPI_Datatype
)0x4c000405)),(procs_candidates),(1),(((MPI_Datatype)0x4c000405
)),(PetscObjectComm((PetscObject)mat))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7223,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7224 for (i=0,ncand=0;i<size;i++) {
7225 if (!procs_candidates[i]) {
7226 procs_candidates[ncand++] = i;
7227 }
7228 }
7229 /* force n_subdomains to be not greater that the number of non-active processes */
7230 *n_subdomains = PetscMin(void_procs,*n_subdomains)(((void_procs)<(*n_subdomains)) ? (void_procs) : (*n_subdomains
))
;
7231 }
7232
7233 /* number of subdomains requested greater than active processes or matrix size -> just shift the matrix
7234 number of subdomains requested 1 -> send to master or first candidate in voids */
7235 ierr = MatGetSize(mat,&N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7235,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7236 if (active_procs < *n_subdomains || *n_subdomains == 1 || N <= *n_subdomains) {
7237 PetscInt issize,isidx,dest;
7238 if (*n_subdomains == 1) dest = 0;
7239 else dest = rank;
7240 if (im_active) {
7241 issize = 1;
7242 if (procs_candidates) { /* shift the pattern on non-active candidates (if any) */
7243 isidx = procs_candidates[dest];
7244 } else {
7245 isidx = dest;
7246 }
7247 } else {
7248 issize = 0;
7249 isidx = -1;
7250 }
7251 if (*n_subdomains != 1) *n_subdomains = active_procs;
7252 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)mat),issize,&isidx,PETSC_COPY_VALUES,is_sends);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7252,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7253 ierr = PetscFree(procs_candidates)((*PetscTrFree)((void*)(procs_candidates),7253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((procs_candidates) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7254 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7255 }
7256 ierr = PetscOptionsGetBool(NULL((void*)0),NULL((void*)0),"-matis_partitioning_use_vwgt",&use_vwgt,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7257 ierr = PetscOptionsGetInt(NULL((void*)0),NULL((void*)0),"-matis_partitioning_threshold",&threshold,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7258 threshold = PetscMax(threshold,2)(((threshold)<(2)) ? (2) : (threshold));
7259
7260 /* Get info on mapping */
7261 ierr = ISLocalToGlobalMappingGetInfo(mat->rmap->mapping,&n_neighs,&neighs,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7261,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7262
7263 /* build local CSR graph of subdomains' connectivity */
7264 ierr = PetscMalloc1(2,&xadj)PetscMallocA(1,PETSC_FALSE,7264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(2)*sizeof(**(&xadj)),(&xadj))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7265 xadj[0] = 0;
7266 xadj[1] = PetscMax(n_neighs-1,0)(((n_neighs-1)<(0)) ? (0) : (n_neighs-1));
7267 ierr = PetscMalloc1(xadj[1],&adjncy)PetscMallocA(1,PETSC_FALSE,7267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(xadj[1])*sizeof(**(&adjncy)),(&adjncy))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7268 ierr = PetscMalloc1(xadj[1],&adjncy_wgt)PetscMallocA(1,PETSC_FALSE,7268,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(xadj[1])*sizeof(**(&adjncy_wgt)),(&adjncy_wgt
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7268,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7269 ierr = PetscCalloc1(n,&count)PetscMallocA(1,PETSC_TRUE,7269,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&count)),(&count))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7269,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7270 for (i=1;i<n_neighs;i++)
7271 for (j=0;j<n_shared[i];j++)
7272 count[shared[i][j]] += 1;
7273
7274 xadj_count = 0;
7275 for (i=1;i<n_neighs;i++) {
7276 for (j=0;j<n_shared[i];j++) {
7277 if (count[shared[i][j]] < threshold) {
7278 adjncy[xadj_count] = neighs[i];
7279 adjncy_wgt[xadj_count] = n_shared[i];
7280 xadj_count++;
7281 break;
7282 }
7283 }
7284 }
7285 xadj[1] = xadj_count;
7286 ierr = PetscFree(count)((*PetscTrFree)((void*)(count),7286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((count) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7287 ierr = ISLocalToGlobalMappingRestoreInfo(mat->rmap->mapping,&n_neighs,&neighs,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7288 ierr = PetscSortIntWithArray(xadj[1],adjncy,adjncy_wgt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7289
7290 ierr = PetscMalloc1(1,&ranks_send_to_idx)PetscMallocA(1,PETSC_FALSE,7290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(1)*sizeof(**(&ranks_send_to_idx)),(&ranks_send_to_idx
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7290,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7291
7292 /* Restrict work on active processes only */
7293 ierr = PetscMPIIntCast(im_active,&color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7293,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7294 if (void_procs) {
7295 ierr = PetscSubcommCreate(PetscObjectComm((PetscObject)mat),&psubcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7296 ierr = PetscSubcommSetNumber(psubcomm,2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* 2 groups, active process and not active processes */
7297 ierr = PetscSubcommSetTypeGeneral(psubcomm,color,rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7298 subcomm = PetscSubcommChild(psubcomm);
7299 } else {
7300 psubcomm = NULL((void*)0);
7301 subcomm = PetscObjectComm((PetscObject)mat);
7302 }
7303
7304 v_wgt = NULL((void*)0);
7305 if (!color) {
7306 ierr = PetscFree(xadj)((*PetscTrFree)((void*)(xadj),7306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((xadj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7307 ierr = PetscFree(adjncy)((*PetscTrFree)((void*)(adjncy),7307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7308 ierr = PetscFree(adjncy_wgt)((*PetscTrFree)((void*)(adjncy_wgt),7308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy_wgt) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7309 } else {
7310 Mat subdomain_adj;
7311 IS new_ranks,new_ranks_contig;
7312 MatPartitioning partitioner;
7313 PetscInt rstart=0,rend=0;
7314 PetscInt *is_indices,*oldranks;
7315 PetscMPIInt size;
7316 PetscBool aggregate;
7317
7318 ierr = MPI_Comm_size(subcomm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7318,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7319 if (void_procs) {
7320 PetscInt prank = rank;
7321 ierr = PetscMalloc1(size,&oldranks)PetscMallocA(1,PETSC_FALSE,7321,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(size)*sizeof(**(&oldranks)),(&oldranks))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7321,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7322 ierr = MPI_Allgather(&prank,1,MPIU_INT,oldranks,1,MPIU_INT,subcomm)((petsc_gather_ct += PetscMPIParallelComm((subcomm)),0) || MPI_Allgather
((&prank),(1),(((MPI_Datatype)0x4c000405)),(oldranks),(1)
,(((MPI_Datatype)0x4c000405)),(subcomm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7322,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7323 for (i=0;i<xadj[1];i++) {
7324 ierr = PetscFindInt(adjncy[i],size,oldranks,&adjncy[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7324,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7325 }
7326 ierr = PetscSortIntWithArray(xadj[1],adjncy,adjncy_wgt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7326,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7327 } else {
7328 oldranks = NULL((void*)0);
7329 }
7330 aggregate = ((redprocs > 0 && redprocs < size) ? PETSC_TRUE : PETSC_FALSE);
7331 if (aggregate) { /* TODO: all this part could be made more efficient */
7332 PetscInt lrows,row,ncols,*cols;
7333 PetscMPIInt nrank;
7334 PetscScalar *vals;
7335
7336 ierr = MPI_Comm_rank(subcomm,&nrank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7337 lrows = 0;
7338 if (nrank<redprocs) {
7339 lrows = size/redprocs;
7340 if (nrank<size%redprocs) lrows++;
7341 }
7342 ierr = MatCreateAIJ(subcomm,lrows,lrows,size,size,50,NULL((void*)0),50,NULL((void*)0),&subdomain_adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7342,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7343 ierr = MatGetOwnershipRange(subdomain_adj,&rstart,&rend);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7343,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7344 ierr = MatSetOption(subdomain_adj,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7344,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7345 ierr = MatSetOption(subdomain_adj,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7346 row = nrank;
7347 ncols = xadj[1]-xadj[0];
7348 cols = adjncy;
7349 ierr = PetscMalloc1(ncols,&vals)PetscMallocA(1,PETSC_FALSE,7349,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(ncols)*sizeof(**(&vals)),(&vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7349,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7350 for (i=0;i<ncols;i++) vals[i] = adjncy_wgt[i];
7351 ierr = MatSetValues(subdomain_adj,1,&row,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7352 ierr = MatAssemblyBegin(subdomain_adj,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7352,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7353 ierr = MatAssemblyEnd(subdomain_adj,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7353,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7354 ierr = PetscFree(xadj)((*PetscTrFree)((void*)(xadj),7354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((xadj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7355 ierr = PetscFree(adjncy)((*PetscTrFree)((void*)(adjncy),7355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7356 ierr = PetscFree(adjncy_wgt)((*PetscTrFree)((void*)(adjncy_wgt),7356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy_wgt) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7357 ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),7357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7358 if (use_vwgt) {
7359 Vec v;
7360 const PetscScalar *array;
7361 PetscInt nl;
7362
7363 ierr = MatCreateVecs(subdomain_adj,&v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7364 ierr = VecSetValue(v,row,(PetscScalar)n,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7365 ierr = VecAssemblyBegin(v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7365,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7366 ierr = VecAssemblyEnd(v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7366,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7367 ierr = VecGetLocalSize(v,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7367,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7368 ierr = VecGetArrayRead(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7368,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7369 ierr = PetscMalloc1(nl,&v_wgt)PetscMallocA(1,PETSC_FALSE,7369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nl)*sizeof(**(&v_wgt)),(&v_wgt))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7370 for (i=0;i<nl;i++) v_wgt[i] = (PetscInt)PetscRealPart(array[i])(array[i]);
7371 ierr = VecRestoreArrayRead(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7371,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7372 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7372,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7373 }
7374 } else {
7375 ierr = MatCreateMPIAdj(subcomm,1,(PetscInt)size,xadj,adjncy,adjncy_wgt,&subdomain_adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7375,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7376 if (use_vwgt) {
7377 ierr = PetscMalloc1(1,&v_wgt)PetscMallocA(1,PETSC_FALSE,7377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(1)*sizeof(**(&v_wgt)),(&v_wgt))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7378 v_wgt[0] = n;
7379 }
7380 }
7381 /* ierr = MatView(subdomain_adj,0);CHKERRQ(ierr); */
7382
7383 /* Partition */
7384 ierr = MatPartitioningCreate(subcomm,&partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7385#if defined(PETSC_HAVE_PTSCOTCH1)
7386 ierr = MatPartitioningSetType(partitioner,MATPARTITIONINGPTSCOTCH"ptscotch");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7386,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7387#elif defined(PETSC_HAVE_PARMETIS1)
7388 ierr = MatPartitioningSetType(partitioner,MATPARTITIONINGPARMETIS"parmetis");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7388,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7389#else
7390 ierr = MatPartitioningSetType(partitioner,MATPARTITIONINGAVERAGE"average");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7391#endif
7392 ierr = MatPartitioningSetAdjacency(partitioner,subdomain_adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7392,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7393 if (v_wgt) {
7394 ierr = MatPartitioningSetVertexWeights(partitioner,v_wgt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7394,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7395 }
7396 *n_subdomains = PetscMin((PetscInt)size,*n_subdomains)((((PetscInt)size)<(*n_subdomains)) ? ((PetscInt)size) : (
*n_subdomains))
;
7397 ierr = MatPartitioningSetNParts(partitioner,*n_subdomains);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7397,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7398 ierr = MatPartitioningSetFromOptions(partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7398,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7399 ierr = MatPartitioningApply(partitioner,&new_ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7399,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7400 /* ierr = MatPartitioningView(partitioner,0);CHKERRQ(ierr); */
7401
7402 /* renumber new_ranks to avoid "holes" in new set of processors */
7403 ierr = ISRenumber(new_ranks,NULL((void*)0),NULL((void*)0),&new_ranks_contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7403,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7404 ierr = ISDestroy(&new_ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7405 ierr = ISGetIndices(new_ranks_contig,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7405,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7406 if (!aggregate) {
7407 if (procs_candidates) { /* shift the pattern on non-active candidates (if any) */
7408#if defined(PETSC_USE_DEBUG1)
7409 if (!oldranks) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"This should not happen")return PetscError(((MPI_Comm)0x44000001),7409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
7410#endif
7411 ranks_send_to_idx[0] = procs_candidates[oldranks[is_indices[0]]];
7412 } else if (oldranks) {
7413 ranks_send_to_idx[0] = oldranks[is_indices[0]];
7414 } else {
7415 ranks_send_to_idx[0] = is_indices[0];
7416 }
7417 } else {
7418 PetscInt idx = 0;
7419 PetscMPIInt tag;
7420 MPI_Request *reqs;
7421
7422 ierr = PetscObjectGetNewTag((PetscObject)subdomain_adj,&tag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7422,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7423 ierr = PetscMalloc1(rend-rstart,&reqs)PetscMallocA(1,PETSC_FALSE,7423,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(rend-rstart)*sizeof(**(&reqs)),(&reqs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7423,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7424 for (i=rstart;i<rend;i++) {
7425 ierr = MPI_Isend(is_indices+i-rstart,1,MPIU_INT,i,tag,subcomm,&reqs[i-rstart])((petsc_isend_ct++,0) || PetscMPITypeSize(&(petsc_isend_len
),(1),(((MPI_Datatype)0x4c000405))) || MPI_Isend((is_indices+
i-rstart),(1),(((MPI_Datatype)0x4c000405)),(i),(tag),(subcomm
),(&reqs[i-rstart])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7425,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7426 }
7427 ierr = MPI_Recv(&idx,1,MPIU_INT,MPI_ANY_SOURCE,tag,subcomm,MPI_STATUS_IGNORE)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len
),(1),(((MPI_Datatype)0x4c000405))) || MPI_Recv((&idx),(1
),(((MPI_Datatype)0x4c000405)),((-2)),(tag),(subcomm),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7427,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7428 ierr = MPI_Waitall(rend-rstart,reqs,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (rend-rstart),0) || MPI_Waitall((rend-rstart),(reqs),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7429 ierr = PetscFree(reqs)((*PetscTrFree)((void*)(reqs),7429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((reqs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7430 if (procs_candidates) { /* shift the pattern on non-active candidates (if any) */
7431#if defined(PETSC_USE_DEBUG1)
7432 if (!oldranks) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"This should not happen")return PetscError(((MPI_Comm)0x44000001),7432,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
7433#endif
7434 ranks_send_to_idx[0] = procs_candidates[oldranks[idx]];
7435 } else if (oldranks) {
7436 ranks_send_to_idx[0] = oldranks[idx];
7437 } else {
7438 ranks_send_to_idx[0] = idx;
7439 }
7440 }
7441 ierr = ISRestoreIndices(new_ranks_contig,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7441,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7442 /* clean up */
7443 ierr = PetscFree(oldranks)((*PetscTrFree)((void*)(oldranks),7443,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((oldranks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7443,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7444 ierr = ISDestroy(&new_ranks_contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7444,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7445 ierr = MatDestroy(&subdomain_adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7445,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7446 ierr = MatPartitioningDestroy(&partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7446,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7447 }
7448 ierr = PetscSubcommDestroy(&psubcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7448,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7449 ierr = PetscFree(procs_candidates)((*PetscTrFree)((void*)(procs_candidates),7449,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((procs_candidates) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7449,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7450
7451 /* assemble parallel IS for sends */
7452 i = 1;
7453 if (!color) i=0;
7454 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)mat),i,ranks_send_to_idx,PETSC_OWN_POINTER,is_sends);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7454,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7455 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7456}
7457
7458typedef enum {MATDENSE_PRIVATE=0,MATAIJ_PRIVATE,MATBAIJ_PRIVATE,MATSBAIJ_PRIVATE}MatTypePrivate;
7459
7460PetscErrorCode PCBDDCMatISSubassemble(Mat mat, IS is_sends, PetscInt n_subdomains, PetscBool restrict_comm, PetscBool restrict_full, PetscBool reuse, Mat *mat_n, PetscInt nis, IS isarray[], PetscInt nvecs, Vec nnsp_vec[])
7461{
7462 Mat local_mat;
7463 IS is_sends_internal;
7464 PetscInt rows,cols,new_local_rows;
7465 PetscInt i,bs,buf_size_idxs,buf_size_idxs_is,buf_size_vals,buf_size_vecs;
7466 PetscBool ismatis,isdense,newisdense,destroy_mat;
7467 ISLocalToGlobalMapping l2gmap;
7468 PetscInt* l2gmap_indices;
7469 const PetscInt* is_indices;
7470 MatType new_local_type;
7471 /* buffers */
7472 PetscInt *ptr_idxs,*send_buffer_idxs,*recv_buffer_idxs;
7473 PetscInt *ptr_idxs_is,*send_buffer_idxs_is,*recv_buffer_idxs_is;
7474 PetscInt *recv_buffer_idxs_local;
7475 PetscScalar *ptr_vals,*send_buffer_vals,*recv_buffer_vals;
7476 PetscScalar *ptr_vecs,*send_buffer_vecs,*recv_buffer_vecs;
7477 /* MPI */
7478 MPI_Comm comm,comm_n;
7479 PetscSubcomm subcomm;
7480 PetscMPIInt n_sends,n_recvs,size;
7481 PetscMPIInt *iflags,*ilengths_idxs,*ilengths_vals,*ilengths_idxs_is;
7482 PetscMPIInt *onodes,*onodes_is,*olengths_idxs,*olengths_idxs_is,*olengths_vals;
7483 PetscMPIInt len,tag_idxs,tag_idxs_is,tag_vals,tag_vecs,source_dest;
7484 MPI_Request *send_req_idxs,*send_req_idxs_is,*send_req_vals,*send_req_vecs;
7485 MPI_Request *recv_req_idxs,*recv_req_idxs_is,*recv_req_vals,*recv_req_vecs;
7486 PetscErrorCode ierr;
7487
7488 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7488; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7489 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),7489,
__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(mat,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),7489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(mat))->classid != MAT_CLASSID) { if
(((PetscObject)(mat))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),7489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7489,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
7490 ierr = PetscObjectTypeCompare((PetscObject)mat,MATIS"is",&ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7490,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7491 if (!ismatis) SETERRQ1(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Cannot use %s on a matrix object which is not of type MATIS",PETSC_FUNCTION_NAME)return PetscError(PetscObjectComm((PetscObject)mat),7491,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot use %s on a matrix object which is not of type MATIS"
,__func__)
;
7492 PetscValidLogicalCollectiveInt(mat,n_subdomains,3)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -n_subdomains
; b1[1] = n_subdomains; _7_ierr = (PetscAllreduceBarrierCheck
(PetscObjectComm((PetscObject)mat),2,7492,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7492,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7492
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,3); } while (0)
;
7493 PetscValidLogicalCollectiveBool(mat,restrict_comm,4)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)restrict_comm; b1[1] = (PetscMPIInt)restrict_comm
; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject
)mat),2,7493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7493
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,4); } while (0)
;
7494 PetscValidLogicalCollectiveBool(mat,restrict_full,5)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)restrict_full; b1[1] = (PetscMPIInt)restrict_full
; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject
)mat),2,7494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7494
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,5); } while (0)
;
7495 PetscValidLogicalCollectiveBool(mat,reuse,6)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)reuse; b1[1] = (PetscMPIInt)reuse; _7_ierr = (
PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat),
2,7495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7495
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,6); } while (0)
;
7496 PetscValidLogicalCollectiveInt(mat,nis,8)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nis
; b1[1] = nis; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)mat),2,7496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7496
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,8); } while (0)
;
7497 PetscValidLogicalCollectiveInt(mat,nvecs,10)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nvecs
; b1[1] = nvecs; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)mat),2,7497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7497
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,10); } while (0)
;
7498 if (nvecs) {
7499 if (nvecs > 1) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Just 1 vector supported")return PetscError(PetscObjectComm((PetscObject)mat),7499,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Just 1 vector supported")
;
7500 PetscValidHeaderSpecific(nnsp_vec[0],VEC_CLASSID,11)do { if (!nnsp_vec[0]) return PetscError(((MPI_Comm)0x44000001
),7500,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",11); if
(!PetscCheckPointer(nnsp_vec[0],PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),7500,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,11); if (((PetscObject)(nnsp_vec[0]))->classid != VEC_CLASSID
) { if (((PetscObject)(nnsp_vec[0]))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),7500,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,11); else return PetscError(((MPI_Comm)0x44000001),7500,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,11); } } while (0)
;
7501 }
7502 /* further checks */
7503 ierr = MatISGetLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7503,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7504 ierr = PetscObjectTypeCompare((PetscObject)local_mat,MATSEQDENSE"seqdense",&isdense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7504,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7505 if (!isdense) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Currently cannot subassemble MATIS when local matrix type is not of type SEQDENSE")return PetscError(PetscObjectComm((PetscObject)mat),7505,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Currently cannot subassemble MATIS when local matrix type is not of type SEQDENSE"
)
;
7506 ierr = MatGetSize(local_mat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7506,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7507 if (rows != cols) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Local MATIS matrices should be square")return PetscError(PetscObjectComm((PetscObject)mat),7507,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Local MATIS matrices should be square"
)
;
7508 if (reuse && *mat_n) {
7509 PetscInt mrows,mcols,mnrows,mncols;
7510 PetscValidHeaderSpecific(*mat_n,MAT_CLASSID,7)do { if (!*mat_n) return PetscError(((MPI_Comm)0x44000001),7510
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",7); if (
!PetscCheckPointer(*mat_n,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),7510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,7); if (((PetscObject)(*mat_n))->classid != MAT_CLASSID) {
if (((PetscObject)(*mat_n))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),7510,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,7); else return PetscError(((MPI_Comm)0x44000001),7510,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,7); } } while (0)
;
7511 ierr = PetscObjectTypeCompare((PetscObject)*mat_n,MATIS"is",&ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7511,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7512 if (!ismatis) SETERRQ(PetscObjectComm((PetscObject)*mat_n),PETSC_ERR_SUP,"Cannot reuse a matrix which is not of type MATIS")return PetscError(PetscObjectComm((PetscObject)*mat_n),7512,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot reuse a matrix which is not of type MATIS"
)
;
7513 ierr = MatGetSize(mat,&mrows,&mcols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7513,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7514 ierr = MatGetSize(*mat_n,&mnrows,&mncols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7514,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7515 if (mrows != mnrows) SETERRQ2(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Cannot reuse matrix! Wrong number of rows %D != %D",mrows,mnrows)return PetscError(PetscObjectComm((PetscObject)mat),7515,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot reuse matrix! Wrong number of rows %D != %D"
,mrows,mnrows)
;
7516 if (mcols != mncols) SETERRQ2(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Cannot reuse matrix! Wrong number of cols %D != %D",mcols,mncols)return PetscError(PetscObjectComm((PetscObject)mat),7516,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot reuse matrix! Wrong number of cols %D != %D"
,mcols,mncols)
;
7517 }
7518 ierr = MatGetBlockSize(local_mat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7518,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7519 PetscValidLogicalCollectiveInt(mat,bs,0)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -bs
; b1[1] = bs; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)mat),2,7519,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)mat))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)mat)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),7519,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7519
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,0); } while (0)
;
7520
7521 /* prepare IS for sending if not provided */
7522 if (!is_sends) {
7523 if (!n_subdomains) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"You should specify either an IS or a target number of subdomains")return PetscError(PetscObjectComm((PetscObject)mat),7523,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"You should specify either an IS or a target number of subdomains"
)
;
7524 ierr = PCBDDCMatISGetSubassemblingPattern(mat,&n_subdomains,0,&is_sends_internal,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7524,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7525 } else {
7526 ierr = PetscObjectReference((PetscObject)is_sends);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7526,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7527 is_sends_internal = is_sends;
7528 }
7529
7530 /* get comm */
7531 ierr = PetscObjectGetComm((PetscObject)mat,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7532
7533 /* compute number of sends */
7534 ierr = ISGetLocalSize(is_sends_internal,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7534,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7535 ierr = PetscMPIIntCast(i,&n_sends);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7535,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7536
7537 /* compute number of receives */
7538 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7538,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7539 ierr = PetscMalloc1(size,&iflags)PetscMallocA(1,PETSC_FALSE,7539,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(size)*sizeof(**(&iflags)),(&iflags))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7539,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7540 ierr = PetscMemzero(iflags,size*sizeof(*iflags));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7540,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7541 ierr = ISGetIndices(is_sends_internal,&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7541,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7542 for (i=0;i<n_sends;i++) iflags[is_indices[i]] = 1;
7543 ierr = PetscGatherNumberOfMessages(comm,iflags,NULL((void*)0),&n_recvs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7543,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7544 ierr = PetscFree(iflags)((*PetscTrFree)((void*)(iflags),7544,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((iflags) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7544,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7545
7546 /* restrict comm if requested */
7547 subcomm = 0;
7548 destroy_mat = PETSC_FALSE;
7549 if (restrict_comm) {
7550 PetscMPIInt color,subcommsize;
7551
7552 color = 0;
7553 if (restrict_full) {
7554 if (!n_recvs) color = 1; /* processes not receiving anything will not partecipate in new comm (full restriction) */
7555 } else {
7556 if (!n_recvs && n_sends) color = 1; /* just those processes that are sending but not receiving anything will not partecipate in new comm */
7557 }
7558 ierr = MPIU_Allreduce(&color,&subcommsize,1,MPI_INT,MPI_SUM,comm)(PetscAllreduceBarrierCheck(comm,1,7558,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) ||
MPI_Allreduce((&color),(&subcommsize),(1),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000003)),(comm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7558,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7559 subcommsize = size - subcommsize;
7560 /* check if reuse has been requested */
7561 if (reuse) {
7562 if (*mat_n) {
7563 PetscMPIInt subcommsize2;
7564 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)*mat_n),&subcommsize2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7564,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7565 if (subcommsize != subcommsize2) SETERRQ2(PetscObjectComm((PetscObject)*mat_n),PETSC_ERR_PLIB,"Cannot reuse matrix! wrong subcomm size %d != %d",subcommsize,subcommsize2)return PetscError(PetscObjectComm((PetscObject)*mat_n),7565,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Cannot reuse matrix! wrong subcomm size %d != %d"
,subcommsize,subcommsize2)
;
7566 comm_n = PetscObjectComm((PetscObject)*mat_n);
7567 } else {
7568 comm_n = PETSC_COMM_SELF((MPI_Comm)0x44000001);
7569 }
7570 } else { /* MAT_INITIAL_MATRIX */
7571 PetscMPIInt rank;
7572
7573 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7574 ierr = PetscSubcommCreate(comm,&subcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7574,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7575 ierr = PetscSubcommSetNumber(subcomm,2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7575,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7576 ierr = PetscSubcommSetTypeGeneral(subcomm,color,rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7576,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7577 comm_n = PetscSubcommChild(subcomm);
7578 }
7579 /* flag to destroy *mat_n if not significative */
7580 if (color) destroy_mat = PETSC_TRUE;
7581 } else {
7582 comm_n = comm;
7583 }
7584
7585 /* prepare send/receive buffers */
7586 ierr = PetscMalloc1(size,&ilengths_idxs)PetscMallocA(1,PETSC_FALSE,7586,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(size)*sizeof(**(&ilengths_idxs)),(&ilengths_idxs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7586,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7587 ierr = PetscMemzero(ilengths_idxs,size*sizeof(*ilengths_idxs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7587,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7588 ierr = PetscMalloc1(size,&ilengths_vals)PetscMallocA(1,PETSC_FALSE,7588,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(size)*sizeof(**(&ilengths_vals)),(&ilengths_vals
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7588,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7589 ierr = PetscMemzero(ilengths_vals,size*sizeof(*ilengths_vals));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7589,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7590 if (nis) {
7591 ierr = PetscCalloc1(size,&ilengths_idxs_is)PetscMallocA(1,PETSC_TRUE,7591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(size)*sizeof(**(&ilengths_idxs_is)),(&ilengths_idxs_is
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7591,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7592 }
7593
7594 /* Get data from local matrices */
7595 if (!isdense) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Subassembling of AIJ local matrices not yet implemented")return PetscError(PetscObjectComm((PetscObject)mat),7595,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Subassembling of AIJ local matrices not yet implemented"
)
;
7596 /* TODO: See below some guidelines on how to prepare the local buffers */
7597 /*
7598 send_buffer_vals should contain the raw values of the local matrix
7599 send_buffer_idxs should contain:
7600 - MatType_PRIVATE type
7601 - PetscInt size_of_l2gmap
7602 - PetscInt global_row_indices[size_of_l2gmap]
7603 - PetscInt all_other_info_which_is_needed_to_compute_preallocation_and_set_values
7604 */
7605 else {
7606 ierr = MatDenseGetArray(local_mat,&send_buffer_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7606,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7607 ierr = ISLocalToGlobalMappingGetSize(mat->rmap->mapping,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7607,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7608 ierr = PetscMalloc1(i+2,&send_buffer_idxs)PetscMallocA(1,PETSC_FALSE,7608,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(i+2)*sizeof(**(&send_buffer_idxs)),(&send_buffer_idxs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7608,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7609 send_buffer_idxs[0] = (PetscInt)MATDENSE_PRIVATE;
7610 send_buffer_idxs[1] = i;
7611 ierr = ISLocalToGlobalMappingGetIndices(mat->rmap->mapping,(const PetscInt**)&ptr_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7611,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7612 ierr = PetscMemcpy(&send_buffer_idxs[2],ptr_idxs,i*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7612,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7613 ierr = ISLocalToGlobalMappingRestoreIndices(mat->rmap->mapping,(const PetscInt**)&ptr_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7613,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7614 ierr = PetscMPIIntCast(i,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7614,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7615 for (i=0;i<n_sends;i++) {
7616 ilengths_vals[is_indices[i]] = len*len;
7617 ilengths_idxs[is_indices[i]] = len+2;
7618 }
7619 }
7620 ierr = PetscGatherMessageLengths2(comm,n_sends,n_recvs,ilengths_idxs,ilengths_vals,&onodes,&olengths_idxs,&olengths_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7621 /* additional is (if any) */
7622 if (nis) {
7623 PetscMPIInt psum;
7624 PetscInt j;
7625 for (j=0,psum=0;j<nis;j++) {
7626 PetscInt plen;
7627 ierr = ISGetLocalSize(isarray[j],&plen);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7627,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7628 ierr = PetscMPIIntCast(plen,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7628,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7629 psum += len+1; /* indices + lenght */
7630 }
7631 ierr = PetscMalloc1(psum,&send_buffer_idxs_is)PetscMallocA(1,PETSC_FALSE,7631,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(psum)*sizeof(**(&send_buffer_idxs_is)),(&send_buffer_idxs_is
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7631,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7632 for (j=0,psum=0;j<nis;j++) {
7633 PetscInt plen;
7634 const PetscInt *is_array_idxs;
7635 ierr = ISGetLocalSize(isarray[j],&plen);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7636 send_buffer_idxs_is[psum] = plen;
7637 ierr = ISGetIndices(isarray[j],&is_array_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7637,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7638 ierr = PetscMemcpy(&send_buffer_idxs_is[psum+1],is_array_idxs,plen*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7638,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7639 ierr = ISRestoreIndices(isarray[j],&is_array_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7640 psum += plen+1; /* indices + lenght */
7641 }
7642 for (i=0;i<n_sends;i++) {
7643 ilengths_idxs_is[is_indices[i]] = psum;
7644 }
7645 ierr = PetscGatherMessageLengths(comm,n_sends,n_recvs,ilengths_idxs_is,&onodes_is,&olengths_idxs_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7645,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7646 }
7647 ierr = MatISRestoreLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7647,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7648
7649 buf_size_idxs = 0;
7650 buf_size_vals = 0;
7651 buf_size_idxs_is = 0;
7652 buf_size_vecs = 0;
7653 for (i=0;i<n_recvs;i++) {
7654 buf_size_idxs += (PetscInt)olengths_idxs[i];
7655 buf_size_vals += (PetscInt)olengths_vals[i];
7656 if (nis) buf_size_idxs_is += (PetscInt)olengths_idxs_is[i];
7657 if (nvecs) buf_size_vecs += (PetscInt)olengths_idxs[i];
7658 }
7659 ierr = PetscMalloc1(buf_size_idxs,&recv_buffer_idxs)PetscMallocA(1,PETSC_FALSE,7659,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(buf_size_idxs)*sizeof(**(&recv_buffer_idxs)),(&
recv_buffer_idxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7659,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7660 ierr = PetscMalloc1(buf_size_vals,&recv_buffer_vals)PetscMallocA(1,PETSC_FALSE,7660,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(buf_size_vals)*sizeof(**(&recv_buffer_vals)),(&
recv_buffer_vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7660,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7661 ierr = PetscMalloc1(buf_size_idxs_is,&recv_buffer_idxs_is)PetscMallocA(1,PETSC_FALSE,7661,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(buf_size_idxs_is)*sizeof(**(&recv_buffer_idxs_is
)),(&recv_buffer_idxs_is))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7661,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7662 ierr = PetscMalloc1(buf_size_vecs,&recv_buffer_vecs)PetscMallocA(1,PETSC_FALSE,7662,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(buf_size_vecs)*sizeof(**(&recv_buffer_vecs)),(&
recv_buffer_vecs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7662,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7663
7664 /* get new tags for clean communications */
7665 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7665,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7666 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7666,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7667 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_idxs_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7667,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7668 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7668,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7669
7670 /* allocate for requests */
7671 ierr = PetscMalloc1(n_sends,&send_req_idxs)PetscMallocA(1,PETSC_FALSE,7671,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_sends)*sizeof(**(&send_req_idxs)),(&send_req_idxs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7671,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7672 ierr = PetscMalloc1(n_sends,&send_req_vals)PetscMallocA(1,PETSC_FALSE,7672,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_sends)*sizeof(**(&send_req_vals)),(&send_req_vals
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7672,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7673 ierr = PetscMalloc1(n_sends,&send_req_idxs_is)PetscMallocA(1,PETSC_FALSE,7673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_sends)*sizeof(**(&send_req_idxs_is)),(&send_req_idxs_is
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7673,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7674 ierr = PetscMalloc1(n_sends,&send_req_vecs)PetscMallocA(1,PETSC_FALSE,7674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_sends)*sizeof(**(&send_req_vecs)),(&send_req_vecs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7674,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7675 ierr = PetscMalloc1(n_recvs,&recv_req_idxs)PetscMallocA(1,PETSC_FALSE,7675,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_recvs)*sizeof(**(&recv_req_idxs)),(&recv_req_idxs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7675,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7676 ierr = PetscMalloc1(n_recvs,&recv_req_vals)PetscMallocA(1,PETSC_FALSE,7676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_recvs)*sizeof(**(&recv_req_vals)),(&recv_req_vals
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7676,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7677 ierr = PetscMalloc1(n_recvs,&recv_req_idxs_is)PetscMallocA(1,PETSC_FALSE,7677,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_recvs)*sizeof(**(&recv_req_idxs_is)),(&recv_req_idxs_is
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7677,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7678 ierr = PetscMalloc1(n_recvs,&recv_req_vecs)PetscMallocA(1,PETSC_FALSE,7678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n_recvs)*sizeof(**(&recv_req_vecs)),(&recv_req_vecs
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7679
7680 /* communications */
7681 ptr_idxs = recv_buffer_idxs;
7682 ptr_vals = recv_buffer_vals;
7683 ptr_idxs_is = recv_buffer_idxs_is;
7684 ptr_vecs = recv_buffer_vecs;
7685 for (i=0;i<n_recvs;i++) {
7686 source_dest = onodes[i];
7687 ierr = MPI_Irecv(ptr_idxs,olengths_idxs[i],MPIU_INT,source_dest,tag_idxs,comm,&recv_req_idxs[i])((petsc_irecv_ct++,0) || PetscMPITypeSize(&(petsc_irecv_len
),(olengths_idxs[i]),(((MPI_Datatype)0x4c000405))) || MPI_Irecv
((ptr_idxs),(olengths_idxs[i]),(((MPI_Datatype)0x4c000405)),(
source_dest),(tag_idxs),(comm),(&recv_req_idxs[i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7687,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7688 ierr = MPI_Irecv(ptr_vals,olengths_vals[i],MPIU_SCALAR,source_dest,tag_vals,comm,&recv_req_vals[i])((petsc_irecv_ct++,0) || PetscMPITypeSize(&(petsc_irecv_len
),(olengths_vals[i]),(((MPI_Datatype)0x4c00080b))) || MPI_Irecv
((ptr_vals),(olengths_vals[i]),(((MPI_Datatype)0x4c00080b)),(
source_dest),(tag_vals),(comm),(&recv_req_vals[i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7688,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7689 ptr_idxs += olengths_idxs[i];
7690 ptr_vals += olengths_vals[i];
7691 if (nis) {
7692 source_dest = onodes_is[i];
7693 ierr = MPI_Irecv(ptr_idxs_is,olengths_idxs_is[i],MPIU_INT,source_dest,tag_idxs_is,comm,&recv_req_idxs_is[i])((petsc_irecv_ct++,0) || PetscMPITypeSize(&(petsc_irecv_len
),(olengths_idxs_is[i]),(((MPI_Datatype)0x4c000405))) || MPI_Irecv
((ptr_idxs_is),(olengths_idxs_is[i]),(((MPI_Datatype)0x4c000405
)),(source_dest),(tag_idxs_is),(comm),(&recv_req_idxs_is[
i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7694 ptr_idxs_is += olengths_idxs_is[i];
7695 }
7696 if (nvecs) {
7697 source_dest = onodes[i];
7698 ierr = MPI_Irecv(ptr_vecs,olengths_idxs[i]-2,MPIU_SCALAR,source_dest,tag_vecs,comm,&recv_req_vecs[i])((petsc_irecv_ct++,0) || PetscMPITypeSize(&(petsc_irecv_len
),(olengths_idxs[i]-2),(((MPI_Datatype)0x4c00080b))) || MPI_Irecv
((ptr_vecs),(olengths_idxs[i]-2),(((MPI_Datatype)0x4c00080b))
,(source_dest),(tag_vecs),(comm),(&recv_req_vecs[i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7698,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7699 ptr_vecs += olengths_idxs[i]-2;
7700 }
7701 }
7702 for (i=0;i<n_sends;i++) {
7703 ierr = PetscMPIIntCast(is_indices[i],&source_dest);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7703,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7704 ierr = MPI_Isend(send_buffer_idxs,ilengths_idxs[source_dest],MPIU_INT,source_dest,tag_idxs,comm,&send_req_idxs[i])((petsc_isend_ct++,0) || PetscMPITypeSize(&(petsc_isend_len
),(ilengths_idxs[source_dest]),(((MPI_Datatype)0x4c000405))) ||
MPI_Isend((send_buffer_idxs),(ilengths_idxs[source_dest]),((
(MPI_Datatype)0x4c000405)),(source_dest),(tag_idxs),(comm),(&
send_req_idxs[i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7705 ierr = MPI_Isend(send_buffer_vals,ilengths_vals[source_dest],MPIU_SCALAR,source_dest,tag_vals,comm,&send_req_vals[i])((petsc_isend_ct++,0) || PetscMPITypeSize(&(petsc_isend_len
),(ilengths_vals[source_dest]),(((MPI_Datatype)0x4c00080b))) ||
MPI_Isend((send_buffer_vals),(ilengths_vals[source_dest]),((
(MPI_Datatype)0x4c00080b)),(source_dest),(tag_vals),(comm),(&
send_req_vals[i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7706 if (nis) {
7707 ierr = MPI_Isend(send_buffer_idxs_is,ilengths_idxs_is[source_dest],MPIU_INT,source_dest,tag_idxs_is,comm,&send_req_idxs_is[i])((petsc_isend_ct++,0) || PetscMPITypeSize(&(petsc_isend_len
),(ilengths_idxs_is[source_dest]),(((MPI_Datatype)0x4c000405)
)) || MPI_Isend((send_buffer_idxs_is),(ilengths_idxs_is[source_dest
]),(((MPI_Datatype)0x4c000405)),(source_dest),(tag_idxs_is),(
comm),(&send_req_idxs_is[i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7707,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7708 }
7709 if (nvecs) {
7710 ierr = VecGetArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7710,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7711 ierr = MPI_Isend(send_buffer_vecs,ilengths_idxs[source_dest]-2,MPIU_SCALAR,source_dest,tag_vecs,comm,&send_req_vecs[i])((petsc_isend_ct++,0) || PetscMPITypeSize(&(petsc_isend_len
),(ilengths_idxs[source_dest]-2),(((MPI_Datatype)0x4c00080b))
) || MPI_Isend((send_buffer_vecs),(ilengths_idxs[source_dest]
-2),(((MPI_Datatype)0x4c00080b)),(source_dest),(tag_vecs),(comm
),(&send_req_vecs[i])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7711,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7712 }
7713 }
7714 ierr = ISRestoreIndices(is_sends_internal,&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7715 ierr = ISDestroy(&is_sends_internal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7715,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7716
7717 /* assemble new l2g map */
7718 ierr = MPI_Waitall(n_recvs,recv_req_idxs,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_recvs),0) || MPI_Waitall((n_recvs),(recv_req_idxs),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7718,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7719 ptr_idxs = recv_buffer_idxs;
7720 new_local_rows = 0;
7721 for (i=0;i<n_recvs;i++) {
7722 new_local_rows += *(ptr_idxs+1); /* second element is the local size of the l2gmap */
7723 ptr_idxs += olengths_idxs[i];
7724 }
7725 ierr = PetscMalloc1(new_local_rows,&l2gmap_indices)PetscMallocA(1,PETSC_FALSE,7725,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(new_local_rows)*sizeof(**(&l2gmap_indices)),(&
l2gmap_indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7725,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7726 ptr_idxs = recv_buffer_idxs;
7727 new_local_rows = 0;
7728 for (i=0;i<n_recvs;i++) {
7729 ierr = PetscMemcpy(&l2gmap_indices[new_local_rows],ptr_idxs+2,(*(ptr_idxs+1))*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7729,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7730 new_local_rows += *(ptr_idxs+1); /* second element is the local size of the l2gmap */
7731 ptr_idxs += olengths_idxs[i];
7732 }
7733 ierr = PetscSortRemoveDupsInt(&new_local_rows,l2gmap_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7733,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7734 ierr = ISLocalToGlobalMappingCreate(comm_n,1,new_local_rows,l2gmap_indices,PETSC_COPY_VALUES,&l2gmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7735 ierr = PetscFree(l2gmap_indices)((*PetscTrFree)((void*)(l2gmap_indices),7735,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((l2gmap_indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7735,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7736
7737 /* infer new local matrix type from received local matrices type */
7738 /* currently if all local matrices are of type X, then the resulting matrix will be of type X, except for the dense case */
7739 /* it also assumes that if the block size is set, than it is the same among all local matrices (see checks at the beginning of the function) */
7740 if (n_recvs) {
7741 MatTypePrivate new_local_type_private = (MatTypePrivate)send_buffer_idxs[0];
7742 ptr_idxs = recv_buffer_idxs;
7743 for (i=0;i<n_recvs;i++) {
7744 if ((PetscInt)new_local_type_private != *ptr_idxs) {
7745 new_local_type_private = MATAIJ_PRIVATE;
7746 break;
7747 }
7748 ptr_idxs += olengths_idxs[i];
7749 }
7750 switch (new_local_type_private) {
7751 case MATDENSE_PRIVATE:
7752 new_local_type = MATSEQAIJ"seqaij";
7753 bs = 1;
7754 break;
7755 case MATAIJ_PRIVATE:
7756 new_local_type = MATSEQAIJ"seqaij";
7757 bs = 1;
7758 break;
7759 case MATBAIJ_PRIVATE:
7760 new_local_type = MATSEQBAIJ"seqbaij";
7761 break;
7762 case MATSBAIJ_PRIVATE:
7763 new_local_type = MATSEQSBAIJ"seqsbaij";
7764 break;
7765 default:
7766 SETERRQ2(comm,PETSC_ERR_SUP,"Unsupported private type %d in %s",new_local_type_private,PETSC_FUNCTION_NAME)return PetscError(comm,7766,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Unsupported private type %d in %s",new_local_type_private
,__func__)
;
7767 break;
7768 }
7769 } else { /* by default, new_local_type is seqaij */
7770 new_local_type = MATSEQAIJ"seqaij";
7771 bs = 1;
7772 }
7773
7774 /* create MATIS object if needed */
7775 if (!reuse) {
7776 ierr = MatGetSize(mat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7776,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7777 ierr = MatCreateIS(comm_n,bs,PETSC_DECIDE-1,PETSC_DECIDE-1,rows,cols,l2gmap,NULL((void*)0),mat_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7777,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7778 } else {
7779 /* it also destroys the local matrices */
7780 if (*mat_n) {
7781 ierr = MatSetLocalToGlobalMapping(*mat_n,l2gmap,l2gmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7781,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7782 } else { /* this is a fake object */
7783 ierr = MatCreateIS(comm_n,bs,PETSC_DECIDE-1,PETSC_DECIDE-1,rows,cols,l2gmap,NULL((void*)0),mat_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7783,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7784 }
7785 }
7786 ierr = MatISGetLocalMat(*mat_n,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7786,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7787 ierr = MatSetType(local_mat,new_local_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7787,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7788
7789 ierr = MPI_Waitall(n_recvs,recv_req_vals,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_recvs),0) || MPI_Waitall((n_recvs),(recv_req_vals),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7789,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7790
7791 /* Global to local map of received indices */
7792 ierr = PetscMalloc1(buf_size_idxs,&recv_buffer_idxs_local)PetscMallocA(1,PETSC_FALSE,7792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(buf_size_idxs)*sizeof(**(&recv_buffer_idxs_local
)),(&recv_buffer_idxs_local))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7792,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* needed for values insertion */
7793 ierr = ISGlobalToLocalMappingApply(l2gmap,IS_GTOLM_MASK,buf_size_idxs,recv_buffer_idxs,&i,recv_buffer_idxs_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7794 ierr = ISLocalToGlobalMappingDestroy(&l2gmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7794,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7795
7796 /* restore attributes -> type of incoming data and its size */
7797 buf_size_idxs = 0;
7798 for (i=0;i<n_recvs;i++) {
7799 recv_buffer_idxs_local[buf_size_idxs] = recv_buffer_idxs[buf_size_idxs];
7800 recv_buffer_idxs_local[buf_size_idxs+1] = recv_buffer_idxs[buf_size_idxs+1];
7801 buf_size_idxs += (PetscInt)olengths_idxs[i];
7802 }
7803 ierr = PetscFree(recv_buffer_idxs)((*PetscTrFree)((void*)(recv_buffer_idxs),7803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_buffer_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7804
7805 /* set preallocation */
7806 ierr = PetscObjectTypeCompare((PetscObject)local_mat,MATSEQDENSE"seqdense",&newisdense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7807 if (!newisdense) {
7808 PetscInt *new_local_nnz=0;
7809
7810 ptr_idxs = recv_buffer_idxs_local;
7811 if (n_recvs) {
7812 ierr = PetscCalloc1(new_local_rows,&new_local_nnz)PetscMallocA(1,PETSC_TRUE,7812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(new_local_rows)*sizeof(**(&new_local_nnz)),(&
new_local_nnz))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7812,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7813 }
7814 for (i=0;i<n_recvs;i++) {
7815 PetscInt j;
7816 if (*ptr_idxs == (PetscInt)MATDENSE_PRIVATE) { /* preallocation provided for dense case only */
7817 for (j=0;j<*(ptr_idxs+1);j++) {
7818 new_local_nnz[*(ptr_idxs+2+j)] += *(ptr_idxs+1);
7819 }
7820 } else {
7821 /* TODO */
7822 }
7823 ptr_idxs += olengths_idxs[i];
7824 }
7825 if (new_local_nnz) {
7826 for (i=0;i<new_local_rows;i++) new_local_nnz[i] = PetscMin(new_local_nnz[i],new_local_rows)(((new_local_nnz[i])<(new_local_rows)) ? (new_local_nnz[i]
) : (new_local_rows))
;
7827 ierr = MatSeqAIJSetPreallocation(local_mat,0,new_local_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7828 for (i=0;i<new_local_rows;i++) new_local_nnz[i] /= bs;
7829 ierr = MatSeqBAIJSetPreallocation(local_mat,bs,0,new_local_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7829,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7830 for (i=0;i<new_local_rows;i++) new_local_nnz[i] = PetscMax(new_local_nnz[i]-i,0)(((new_local_nnz[i]-i)<(0)) ? (0) : (new_local_nnz[i]-i));
7831 ierr = MatSeqSBAIJSetPreallocation(local_mat,bs,0,new_local_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7831,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7832 } else {
7833 ierr = MatSetUp(local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7833,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7834 }
7835 ierr = PetscFree(new_local_nnz)((*PetscTrFree)((void*)(new_local_nnz),7835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((new_local_nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7836 } else {
7837 ierr = MatSetUp(local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7837,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7838 }
7839
7840 /* set values */
7841 ptr_vals = recv_buffer_vals;
7842 ptr_idxs = recv_buffer_idxs_local;
7843 for (i=0;i<n_recvs;i++) {
7844 if (*ptr_idxs == (PetscInt)MATDENSE_PRIVATE) { /* values insertion provided for dense case only */
7845 ierr = MatSetOption(local_mat,MAT_ROW_ORIENTED,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7845,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7846 ierr = MatSetValues(local_mat,*(ptr_idxs+1),ptr_idxs+2,*(ptr_idxs+1),ptr_idxs+2,ptr_vals,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7846,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7847 ierr = MatAssemblyBegin(local_mat,MAT_FLUSH_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7847,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7848 ierr = MatAssemblyEnd(local_mat,MAT_FLUSH_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7848,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7849 ierr = MatSetOption(local_mat,MAT_ROW_ORIENTED,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7849,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7850 } else {
7851 /* TODO */
7852 }
7853 ptr_idxs += olengths_idxs[i];
7854 ptr_vals += olengths_vals[i];
7855 }
7856 ierr = MatAssemblyBegin(local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7857 ierr = MatAssemblyEnd(local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7857,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7858 ierr = MatISRestoreLocalMat(*mat_n,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7859 ierr = MatAssemblyBegin(*mat_n,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7860 ierr = MatAssemblyEnd(*mat_n,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7861 ierr = PetscFree(recv_buffer_vals)((*PetscTrFree)((void*)(recv_buffer_vals),7861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_buffer_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7862
7863#if 0
7864 if (!restrict_comm) { /* check */
7865 Vec lvec,rvec;
7866 PetscReal infty_error;
7867
7868 ierr = MatCreateVecs(mat,&rvec,&lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7869 ierr = VecSetRandom(rvec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7870 ierr = MatMult(mat,rvec,lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7870,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7871 ierr = VecScale(lvec,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7871,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7872 ierr = MatMultAdd(*mat_n,rvec,lvec,lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7872,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7873 ierr = VecNorm(lvec,NORM_INFINITY,&infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7874 ierr = PetscPrintf(PetscObjectComm((PetscObject)mat),"Infinity error subassembling %1.6e\n",infty_error);
7875 ierr = VecDestroy(&rvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7875,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7876 ierr = VecDestroy(&lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7876,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7877 }
7878#endif
7879
7880 /* assemble new additional is (if any) */
7881 if (nis) {
7882 PetscInt **temp_idxs,*count_is,j,psum;
7883
7884 ierr = MPI_Waitall(n_recvs,recv_req_idxs_is,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_recvs),0) || MPI_Waitall((n_recvs),(recv_req_idxs_is),((
MPI_Status *)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7884,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7885 ierr = PetscCalloc1(nis,&count_is)PetscMallocA(1,PETSC_TRUE,7885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nis)*sizeof(**(&count_is)),(&count_is))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7885,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7886 ptr_idxs = recv_buffer_idxs_is;
7887 psum = 0;
7888 for (i=0;i<n_recvs;i++) {
7889 for (j=0;j<nis;j++) {
7890 PetscInt plen = *(ptr_idxs); /* first element is the local size of IS's indices */
7891 count_is[j] += plen; /* increment counting of buffer for j-th IS */
7892 psum += plen;
7893 ptr_idxs += plen+1; /* shift pointer to received data */
7894 }
7895 }
7896 ierr = PetscMalloc1(nis,&temp_idxs)PetscMallocA(1,PETSC_FALSE,7896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nis)*sizeof(**(&temp_idxs)),(&temp_idxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7897 ierr = PetscMalloc1(psum,&temp_idxs[0])PetscMallocA(1,PETSC_FALSE,7897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(psum)*sizeof(**(&temp_idxs[0])),(&temp_idxs
[0]))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7898 for (i=1;i<nis;i++) {
7899 temp_idxs[i] = temp_idxs[i-1]+count_is[i-1];
7900 }
7901 ierr = PetscMemzero(count_is,nis*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7901,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7902 ptr_idxs = recv_buffer_idxs_is;
7903 for (i=0;i<n_recvs;i++) {
7904 for (j=0;j<nis;j++) {
7905 PetscInt plen = *(ptr_idxs); /* first element is the local size of IS's indices */
7906 ierr = PetscMemcpy(&temp_idxs[j][count_is[j]],ptr_idxs+1,plen*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7906,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7907 count_is[j] += plen; /* increment starting point of buffer for j-th IS */
7908 ptr_idxs += plen+1; /* shift pointer to received data */
7909 }
7910 }
7911 for (i=0;i<nis;i++) {
7912 ierr = ISDestroy(&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7912,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7913 ierr = PetscSortRemoveDupsInt(&count_is[i],temp_idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7913,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7913,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7914 ierr = ISCreateGeneral(comm_n,count_is[i],temp_idxs[i],PETSC_COPY_VALUES,&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7915 }
7916 ierr = PetscFree(count_is)((*PetscTrFree)((void*)(count_is),7916,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((count_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7916,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7917 ierr = PetscFree(temp_idxs[0])((*PetscTrFree)((void*)(temp_idxs[0]),7917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((temp_idxs[0]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7917,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7918 ierr = PetscFree(temp_idxs)((*PetscTrFree)((void*)(temp_idxs),7918,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((temp_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7918,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7919 }
7920 /* free workspace */
7921 ierr = PetscFree(recv_buffer_idxs_is)((*PetscTrFree)((void*)(recv_buffer_idxs_is),7921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_buffer_idxs_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7921,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7922 ierr = MPI_Waitall(n_sends,send_req_idxs,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_sends),0) || MPI_Waitall((n_sends),(send_req_idxs),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7922,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7923 ierr = PetscFree(send_buffer_idxs)((*PetscTrFree)((void*)(send_buffer_idxs),7923,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((send_buffer_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7923,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7924 ierr = MPI_Waitall(n_sends,send_req_vals,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_sends),0) || MPI_Waitall((n_sends),(send_req_vals),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7924,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7925 if (isdense) {
7926 ierr = MatISGetLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7926,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7927 ierr = MatDenseRestoreArray(local_mat,&send_buffer_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7927,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7928 ierr = MatISRestoreLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7928,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7929 } else {
7930 /* ierr = PetscFree(send_buffer_vals);CHKERRQ(ierr); */
7931 }
7932 if (nis) {
7933 ierr = MPI_Waitall(n_sends,send_req_idxs_is,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_sends),0) || MPI_Waitall((n_sends),(send_req_idxs_is),((
MPI_Status *)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7933,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7934 ierr = PetscFree(send_buffer_idxs_is)((*PetscTrFree)((void*)(send_buffer_idxs_is),7934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((send_buffer_idxs_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7934,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7935 }
7936
7937 if (nvecs) {
7938 ierr = MPI_Waitall(n_recvs,recv_req_vecs,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_recvs),0) || MPI_Waitall((n_recvs),(recv_req_vecs),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7938,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7939 ierr = MPI_Waitall(n_sends,send_req_vecs,MPI_STATUSES_IGNORE)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble
) (n_sends),0) || MPI_Waitall((n_sends),(send_req_vecs),((MPI_Status
*)1)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7939,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7940 ierr = VecRestoreArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7940,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7941 ierr = VecDestroy(&nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7941,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7942 ierr = VecCreate(comm_n,&nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7942,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7943 ierr = VecSetSizes(nnsp_vec[0],new_local_rows,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7944 ierr = VecSetType(nnsp_vec[0],VECSTANDARD"standard");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7944,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7945 /* set values */
7946 ptr_vals = recv_buffer_vecs;
7947 ptr_idxs = recv_buffer_idxs_local;
7948 ierr = VecGetArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7948,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7949 for (i=0;i<n_recvs;i++) {
7950 PetscInt j;
7951 for (j=0;j<*(ptr_idxs+1);j++) {
7952 send_buffer_vecs[*(ptr_idxs+2+j)] += *(ptr_vals + j);
7953 }
7954 ptr_idxs += olengths_idxs[i];
7955 ptr_vals += olengths_idxs[i]-2;
7956 }
7957 ierr = VecRestoreArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7957,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7958 ierr = VecAssemblyBegin(nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7958,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7959 ierr = VecAssemblyEnd(nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7959,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7960 }
7961
7962 ierr = PetscFree(recv_buffer_vecs)((*PetscTrFree)((void*)(recv_buffer_vecs),7962,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_buffer_vecs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7962,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7963 ierr = PetscFree(recv_buffer_idxs_local)((*PetscTrFree)((void*)(recv_buffer_idxs_local),7963,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_buffer_idxs_local) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7964 ierr = PetscFree(recv_req_idxs)((*PetscTrFree)((void*)(recv_req_idxs),7964,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_req_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7964,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7965 ierr = PetscFree(recv_req_vals)((*PetscTrFree)((void*)(recv_req_vals),7965,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_req_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7965,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7966 ierr = PetscFree(recv_req_vecs)((*PetscTrFree)((void*)(recv_req_vecs),7966,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_req_vecs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7966,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7967 ierr = PetscFree(recv_req_idxs_is)((*PetscTrFree)((void*)(recv_req_idxs_is),7967,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((recv_req_idxs_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7967,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7968 ierr = PetscFree(send_req_idxs)((*PetscTrFree)((void*)(send_req_idxs),7968,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((send_req_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7968,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7969 ierr = PetscFree(send_req_vals)((*PetscTrFree)((void*)(send_req_vals),7969,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((send_req_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7969,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7970 ierr = PetscFree(send_req_vecs)((*PetscTrFree)((void*)(send_req_vecs),7970,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((send_req_vecs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7970,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7971 ierr = PetscFree(send_req_idxs_is)((*PetscTrFree)((void*)(send_req_idxs_is),7971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((send_req_idxs_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7971,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7972 ierr = PetscFree(ilengths_vals)((*PetscTrFree)((void*)(ilengths_vals),7972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ilengths_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7973 ierr = PetscFree(ilengths_idxs)((*PetscTrFree)((void*)(ilengths_idxs),7973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ilengths_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7973,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7974 ierr = PetscFree(olengths_vals)((*PetscTrFree)((void*)(olengths_vals),7974,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((olengths_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7974,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7975 ierr = PetscFree(olengths_idxs)((*PetscTrFree)((void*)(olengths_idxs),7975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((olengths_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7975,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7976 ierr = PetscFree(onodes)((*PetscTrFree)((void*)(onodes),7976,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((onodes) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7976,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7977 if (nis) {
7978 ierr = PetscFree(ilengths_idxs_is)((*PetscTrFree)((void*)(ilengths_idxs_is),7978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ilengths_idxs_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7978,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7979 ierr = PetscFree(olengths_idxs_is)((*PetscTrFree)((void*)(olengths_idxs_is),7979,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((olengths_idxs_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7979,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7980 ierr = PetscFree(onodes_is)((*PetscTrFree)((void*)(onodes_is),7980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((onodes_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7981 }
7982 ierr = PetscSubcommDestroy(&subcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7982,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7983 if (destroy_mat) { /* destroy mat is true only if restrict comm is true and process will not partecipate */
7984 ierr = MatDestroy(mat_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7984,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7985 for (i=0;i<nis;i++) {
7986 ierr = ISDestroy(&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7986,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7987 }
7988 if (nvecs) { /* need to match VecDestroy nnsp_vec called in the other code path */
7989 ierr = VecDestroy(&nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7989,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7990 }
7991 *mat_n = NULL((void*)0);
7992 }
7993 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7994}
7995
7996/* temporary hack into ksp private data structure */
7997#include <petsc/private/kspimpl.h>
7998
7999PetscErrorCode PCBDDCSetUpCoarseSolver(PC pc,PetscScalar* coarse_submat_vals)
8000{
8001 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
8002 PC_IS *pcis = (PC_IS*)pc->data;
8003 Mat coarse_mat,coarse_mat_is,coarse_submat_dense;
8004 Mat coarsedivudotp = NULL((void*)0);
8005 Mat coarseG,t_coarse_mat_is;
8006 MatNullSpace CoarseNullSpace = NULL((void*)0);
8007 ISLocalToGlobalMapping coarse_islg;
8008 IS coarse_is,*isarray,corners;
8009 PetscInt i,im_active=-1,active_procs=-1;
8010 PetscInt nis,nisdofs,nisneu,nisvert;
8011 PetscInt coarse_eqs_per_proc;
8012 PC pc_temp;
8013 PCType coarse_pc_type;
8014 KSPType coarse_ksp_type;
8015 PetscBool multilevel_requested,multilevel_allowed;
8016 PetscBool coarse_reuse;
8017 PetscInt ncoarse,nedcfield;
8018 PetscBool compute_vecs = PETSC_FALSE;
8019 PetscScalar *array;
8020 MatReuse coarse_mat_reuse;
8021 PetscBool restr, full_restr, have_void;
8022 PetscMPIInt size;
8023 PetscErrorCode ierr;
8024
8025 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8025; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8026 ierr = PetscLogEventBegin(PC_BDDC_CoarseSetUp[pcbddc->current_level],pc,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_CoarseSetUp[pcbddc->current_level]].active) ? (*PetscLogPLB
)((PC_BDDC_CoarseSetUp[pcbddc->current_level]),0,(PetscObject
)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject)(0)) : 0
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8026,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8027 /* Assign global numbering to coarse dofs */
8028 if (pcbddc->new_primal_space || pcbddc->coarse_size == -1) { /* a new primal space is present or it is the first initialization, so recompute global numbering */
8029 PetscInt ocoarse_size;
8030 compute_vecs = PETSC_TRUE;
8031
8032 pcbddc->new_primal_space = PETSC_TRUE;
8033 ocoarse_size = pcbddc->coarse_size;
8034 ierr = PetscFree(pcbddc->global_primal_indices)((*PetscTrFree)((void*)(pcbddc->global_primal_indices),8034
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->global_primal_indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8034,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8035 ierr = PCBDDCComputePrimalNumbering(pc,&pcbddc->coarse_size,&pcbddc->global_primal_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8035,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8036 /* see if we can avoid some work */
8037 if (pcbddc->coarse_ksp) { /* coarse ksp has already been created */
8038 /* if the coarse size is different or we are using adaptive selection, better to not reuse the coarse matrix */
8039 if (ocoarse_size != pcbddc->coarse_size || pcbddc->adaptive_selection) {
8040 ierr = KSPReset(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8040,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8041 coarse_reuse = PETSC_FALSE;
8042 } else { /* we can safely reuse already computed coarse matrix */
8043 coarse_reuse = PETSC_TRUE;
8044 }
8045 } else { /* there's no coarse ksp, so we need to create the coarse matrix too */
8046 coarse_reuse = PETSC_FALSE;
8047 }
8048 /* reset any subassembling information */
8049 if (!coarse_reuse || pcbddc->recompute_topography) {
8050 ierr = ISDestroy(&pcbddc->coarse_subassembling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8050,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8051 }
8052 } else { /* primal space is unchanged, so we can reuse coarse matrix */
8053 coarse_reuse = PETSC_TRUE;
8054 }
8055 if (coarse_reuse && pcbddc->coarse_ksp) {
8056 ierr = KSPGetOperators(pcbddc->coarse_ksp,&coarse_mat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8057 ierr = PetscObjectReference((PetscObject)coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8057,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8058 coarse_mat_reuse = MAT_REUSE_MATRIX;
8059 } else {
8060 coarse_mat = NULL((void*)0);
8061 coarse_mat_reuse = MAT_INITIAL_MATRIX;
8062 }
8063
8064 /* creates temporary l2gmap and IS for coarse indexes */
8065 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),pcbddc->local_primal_size,pcbddc->global_primal_indices,PETSC_COPY_VALUES,&coarse_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8065,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8066 ierr = ISLocalToGlobalMappingCreateIS(coarse_is,&coarse_islg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8066,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8067
8068 /* creates temporary MATIS object for coarse matrix */
8069 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->local_primal_size,pcbddc->local_primal_size,coarse_submat_vals,&coarse_submat_dense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8069,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8070 ierr = MatCreateIS(PetscObjectComm((PetscObject)pc),1,PETSC_DECIDE-1,PETSC_DECIDE-1,pcbddc->coarse_size,pcbddc->coarse_size,coarse_islg,NULL((void*)0),&t_coarse_mat_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8071 ierr = MatISSetLocalMat(t_coarse_mat_is,coarse_submat_dense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8071,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8072 ierr = MatAssemblyBegin(t_coarse_mat_is,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8073 ierr = MatAssemblyEnd(t_coarse_mat_is,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8073,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8074 ierr = MatDestroy(&coarse_submat_dense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8074,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8075
8076 /* count "active" (i.e. with positive local size) and "void" processes */
8077 im_active = !!(pcis->n);
8078 ierr = MPIU_Allreduce(&im_active,&active_procs,1,MPIU_INT,MPI_SUM,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&im_active),(&
active_procs),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000003
)),(PetscObjectComm((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8079
8080 /* determine number of processes partecipating to coarse solver and compute subassembling pattern */
8081 /* restr : whether if we want to exclude senders (which are not receivers) from the subassembling pattern */
8082 /* full_restr : just use the receivers from the subassembling pattern */
8083 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)pc),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8083,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8084 coarse_mat_is = NULL((void*)0);
8085 multilevel_allowed = PETSC_FALSE;
8086 multilevel_requested = PETSC_FALSE;
8087 coarse_eqs_per_proc = PetscMin(PetscMax(pcbddc->coarse_size,1),pcbddc->coarse_eqs_per_proc)((((((pcbddc->coarse_size)<(1)) ? (1) : (pcbddc->coarse_size
)))<(pcbddc->coarse_eqs_per_proc)) ? ((((pcbddc->coarse_size
)<(1)) ? (1) : (pcbddc->coarse_size))) : (pcbddc->coarse_eqs_per_proc
))
;
8088 if (coarse_eqs_per_proc < 0) coarse_eqs_per_proc = pcbddc->coarse_size;
8089 if (pcbddc->current_level < pcbddc->max_levels) multilevel_requested = PETSC_TRUE;
8090 if (pcbddc->coarse_size <= pcbddc->coarse_eqs_limit) multilevel_requested = PETSC_FALSE;
8091 if (multilevel_requested) {
8092 ncoarse = active_procs/pcbddc->coarsening_ratio;
8093 restr = PETSC_FALSE;
8094 full_restr = PETSC_FALSE;
8095 } else {
8096 ncoarse = pcbddc->coarse_size/coarse_eqs_per_proc + !!(pcbddc->coarse_size%coarse_eqs_per_proc);
8097 restr = PETSC_TRUE;
8098 full_restr = PETSC_TRUE;
8099 }
8100 if (!pcbddc->coarse_size || size == 1) multilevel_allowed = multilevel_requested = restr = full_restr = PETSC_FALSE;
8101 ncoarse = PetscMax(1,ncoarse)(((1)<(ncoarse)) ? (ncoarse) : (1));
8102 if (!pcbddc->coarse_subassembling) {
8103 if (pcbddc->coarsening_ratio > 1) {
8104 if (multilevel_requested) {
8105 ierr = PCBDDCMatISGetSubassemblingPattern(pc->pmat,&ncoarse,pcbddc->coarse_adj_red,&pcbddc->coarse_subassembling,&have_void);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8105,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8106 } else {
8107 ierr = PCBDDCMatISGetSubassemblingPattern(t_coarse_mat_is,&ncoarse,pcbddc->coarse_adj_red,&pcbddc->coarse_subassembling,&have_void);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8107,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8108 }
8109 } else {
8110 PetscMPIInt rank;
8111 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)pc),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8111,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8112 have_void = (active_procs == (PetscInt)size) ? PETSC_FALSE : PETSC_TRUE;
8113 ierr = ISCreateStride(PetscObjectComm((PetscObject)pc),1,rank,1,&pcbddc->coarse_subassembling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8114 }
8115 } else { /* if a subassembling pattern exists, then we can reuse the coarse ksp and compute the number of process involved */
8116 PetscInt psum;
8117 if (pcbddc->coarse_ksp) psum = 1;
8118 else psum = 0;
8119 ierr = MPIU_Allreduce(&psum,&ncoarse,1,MPIU_INT,MPI_SUM,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8119,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&psum),(&ncoarse
),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000003)),(PetscObjectComm
((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8119,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8120 have_void = ncoarse < size ? PETSC_TRUE : PETSC_FALSE;
8121 }
8122 /* determine if we can go multilevel */
8123 if (multilevel_requested) {
8124 if (ncoarse > 1) multilevel_allowed = PETSC_TRUE; /* found enough processes */
8125 else restr = full_restr = PETSC_TRUE; /* 1 subdomain, use a direct solver */
8126 }
8127 if (multilevel_allowed && have_void) restr = PETSC_TRUE;
8128
8129 /* dump subassembling pattern */
8130 if (pcbddc->dbg_flag && multilevel_allowed) {
8131 ierr = ISView(pcbddc->coarse_subassembling,pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8132 }
8133 /* compute dofs splitting and neumann boundaries for coarse dofs */
8134 nedcfield = -1;
8135 corners = NULL((void*)0);
8136 if (multilevel_allowed && !coarse_reuse && (pcbddc->n_ISForDofsLocal || pcbddc->NeumannBoundariesLocal || pcbddc->nedclocal || pcbddc->corner_selected)) { /* protects from unneded computations */
8137 PetscInt *tidxs,*tidxs2,nout,tsize,i;
8138 const PetscInt *idxs;
8139 ISLocalToGlobalMapping tmap;
8140
8141 /* create map between primal indices (in local representative ordering) and local primal numbering */
8142 ierr = ISLocalToGlobalMappingCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,pcbddc->local_primal_size,pcbddc->primal_indices_local_idxs,PETSC_COPY_VALUES,&tmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8142,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8143 /* allocate space for temporary storage */
8144 ierr = PetscMalloc1(pcbddc->local_primal_size,&tidxs)PetscMallocA(1,PETSC_FALSE,8144,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->local_primal_size)*sizeof(**(&tidxs)
),(&tidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8144,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8145 ierr = PetscMalloc1(pcbddc->local_primal_size,&tidxs2)PetscMallocA(1,PETSC_FALSE,8145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->local_primal_size)*sizeof(**(&tidxs2
)),(&tidxs2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8146 /* allocate for IS array */
8147 nisdofs = pcbddc->n_ISForDofsLocal;
8148 if (pcbddc->nedclocal) {
8149 if (pcbddc->nedfield > -1) {
8150 nedcfield = pcbddc->nedfield;
8151 } else {
8152 nedcfield = 0;
8153 if (nisdofs) SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"This should not happen (%D)",nisdofs)return PetscError(PetscObjectComm((PetscObject)pc),8153,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen (%D)",nisdofs
)
;
8154 nisdofs = 1;
8155 }
8156 }
8157 nisneu = !!pcbddc->NeumannBoundariesLocal;
8158 nisvert = 0; /* nisvert is not used */
8159 nis = nisdofs + nisneu + nisvert;
8160 ierr = PetscMalloc1(nis,&isarray)PetscMallocA(1,PETSC_FALSE,8160,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nis)*sizeof(**(&isarray)),(&isarray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8160,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8161 /* dofs splitting */
8162 for (i=0;i<nisdofs;i++) {
8163 /* ierr = ISView(pcbddc->ISForDofsLocal[i],0);CHKERRQ(ierr); */
8164 if (nedcfield != i) {
8165 ierr = ISGetLocalSize(pcbddc->ISForDofsLocal[i],&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8166 ierr = ISGetIndices(pcbddc->ISForDofsLocal[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8166,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8167 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8167,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8168 ierr = ISRestoreIndices(pcbddc->ISForDofsLocal[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8168,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8169 } else {
8170 ierr = ISGetLocalSize(pcbddc->nedclocal,&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8170,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8171 ierr = ISGetIndices(pcbddc->nedclocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8171,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8172 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8172,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8173 if (tsize != nout) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Failed when mapping coarse nedelec field! %D != %D",tsize,nout)return PetscError(((MPI_Comm)0x44000001),8173,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Failed when mapping coarse nedelec field! %D != %D"
,tsize,nout)
;
8174 ierr = ISRestoreIndices(pcbddc->nedclocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8175 }
8176 ierr = ISLocalToGlobalMappingApply(coarse_islg,nout,tidxs,tidxs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8176,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8177 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),nout,tidxs2,PETSC_COPY_VALUES,&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8177,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8178 /* ierr = ISView(isarray[i],0);CHKERRQ(ierr); */
8179 }
8180 /* neumann boundaries */
8181 if (pcbddc->NeumannBoundariesLocal) {
8182 /* ierr = ISView(pcbddc->NeumannBoundariesLocal,0);CHKERRQ(ierr); */
8183 ierr = ISGetLocalSize(pcbddc->NeumannBoundariesLocal,&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8183,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8184 ierr = ISGetIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8184,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8185 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8185,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8186 ierr = ISRestoreIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8186,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8187 ierr = ISLocalToGlobalMappingApply(coarse_islg,nout,tidxs,tidxs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8187,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8188 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),nout,tidxs2,PETSC_COPY_VALUES,&isarray[nisdofs]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8188,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8189 /* ierr = ISView(isarray[nisdofs],0);CHKERRQ(ierr); */
8190 }
8191 /* coordinates */
8192 if (pcbddc->corner_selected) {
8193 ierr = PCBDDCGraphGetCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8193,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8194 ierr = ISGetLocalSize(corners,&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8194,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8195 ierr = ISGetIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8195,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8196 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8196,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8197 if (tsize != nout) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Failed when mapping corners! %D != %D",tsize,nout)return PetscError(((MPI_Comm)0x44000001),8197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Failed when mapping corners! %D != %D"
,tsize,nout)
;
8198 ierr = ISRestoreIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8198,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8199 ierr = PCBDDCGraphRestoreCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8200 ierr = ISLocalToGlobalMappingApply(coarse_islg,nout,tidxs,tidxs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8200,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8201 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),nout,tidxs2,PETSC_COPY_VALUES,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8201,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8202 }
8203 ierr = PetscFree(tidxs)((*PetscTrFree)((void*)(tidxs),8203,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8203,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8204 ierr = PetscFree(tidxs2)((*PetscTrFree)((void*)(tidxs2),8204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tidxs2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8205 ierr = ISLocalToGlobalMappingDestroy(&tmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8206 } else {
8207 nis = 0;
8208 nisdofs = 0;
8209 nisneu = 0;
8210 nisvert = 0;
8211 isarray = NULL((void*)0);
8212 }
8213 /* destroy no longer needed map */
8214 ierr = ISLocalToGlobalMappingDestroy(&coarse_islg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8214,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8215
8216 /* subassemble */
8217 if (multilevel_allowed) {
8218 Vec vp[1];
8219 PetscInt nvecs = 0;
8220 PetscBool reuse,reuser;
8221
8222 if (coarse_mat) reuse = PETSC_TRUE;
8223 else reuse = PETSC_FALSE;
8224 ierr = MPIU_Allreduce(&reuse,&reuser,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8224,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&reuse),(&reuser
),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm((PetscObject
)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8224,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8225 vp[0] = NULL((void*)0);
8226 if (pcbddc->benign_have_null) { /* propagate no-net-flux quadrature to coarser level */
8227 ierr = VecCreate(PetscObjectComm((PetscObject)pc),&vp[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8227,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8228 ierr = VecSetSizes(vp[0],pcbddc->local_primal_size,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8228,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8229 ierr = VecSetType(vp[0],VECSTANDARD"standard");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8229,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8230 nvecs = 1;
8231
8232 if (pcbddc->divudotp) {
8233 Mat B,loc_divudotp;
8234 Vec v,p;
8235 IS dummy;
8236 PetscInt np;
8237
8238 ierr = MatISGetLocalMat(pcbddc->divudotp,&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8238,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8239 ierr = MatGetSize(loc_divudotp,&np,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8239,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8240 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),np,0,1,&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8240,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8241 ierr = MatCreateSubMatrix(loc_divudotp,dummy,pcis->is_B_local,MAT_INITIAL_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8241,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8242 ierr = MatCreateVecs(B,&v,&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8242,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8243 ierr = VecSet(p,1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8244 ierr = MatMultTranspose(B,p,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8244,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8245 ierr = VecDestroy(&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8246 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8246,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8247 ierr = VecGetArray(vp[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8247,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8248 ierr = VecPlaceArray(pcbddc->vec1_P,array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8249 ierr = VecRestoreArray(vp[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8250 ierr = MatMultTranspose(pcbddc->coarse_phi_B,v,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8250,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8251 ierr = VecResetArray(pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8252 ierr = ISDestroy(&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8252,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8253 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8254 }
8255 }
8256 if (reuser) {
8257 ierr = PCBDDCMatISSubassemble(t_coarse_mat_is,pcbddc->coarse_subassembling,0,restr,full_restr,PETSC_TRUE,&coarse_mat,nis,isarray,nvecs,vp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8257,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8258 } else {
8259 ierr = PCBDDCMatISSubassemble(t_coarse_mat_is,pcbddc->coarse_subassembling,0,restr,full_restr,PETSC_FALSE,&coarse_mat_is,nis,isarray,nvecs,vp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8260 }
8261 if (vp[0]) { /* vp[0] could have been placed on a different set of processes */
8262 PetscScalar *arraym,*arrayv;
8263 PetscInt nl;
8264 ierr = VecGetLocalSize(vp[0],&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8264,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8265 ierr = MatCreateSeqDense(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,nl,NULL((void*)0),&coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8265,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8266 ierr = MatDenseGetArray(coarsedivudotp,&arraym);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8266,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8267 ierr = VecGetArray(vp[0],&arrayv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8267,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8268 ierr = PetscMemcpy(arraym,arrayv,nl*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8268,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8269 ierr = VecRestoreArray(vp[0],&arrayv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8269,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8270 ierr = MatDenseRestoreArray(coarsedivudotp,&arraym);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8270,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8271 ierr = VecDestroy(&vp[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8271,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8272 } else {
8273 ierr = MatCreateSeqAIJ(PETSC_COMM_SELF((MPI_Comm)0x44000001),0,0,1,NULL((void*)0),&coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8273,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8274 }
8275 } else {
8276 ierr = PCBDDCMatISSubassemble(t_coarse_mat_is,pcbddc->coarse_subassembling,0,restr,full_restr,PETSC_FALSE,&coarse_mat_is,0,NULL((void*)0),0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8276,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8277 }
8278 if (coarse_mat_is || coarse_mat) {
8279 if (!multilevel_allowed) {
8280 ierr = MatConvert(coarse_mat_is,MATAIJ"aij",coarse_mat_reuse,&coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8280,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8281 } else {
8282 Mat A;
8283
8284 /* if this matrix is present, it means we are not reusing the coarse matrix */
8285 if (coarse_mat_is) {
8286 if (coarse_mat) SETERRQ(PetscObjectComm((PetscObject)coarse_mat_is),PETSC_ERR_PLIB,"This should not happen")return PetscError(PetscObjectComm((PetscObject)coarse_mat_is)
,8286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
8287 ierr = PetscObjectReference((PetscObject)coarse_mat_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8288 coarse_mat = coarse_mat_is;
8289 }
8290 /* be sure we don't have MatSeqDENSE as local mat */
8291 ierr = MatISGetLocalMat(coarse_mat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8291,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8292 ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8292,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8293 }
8294 }
8295 ierr = MatDestroy(&t_coarse_mat_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8296 ierr = MatDestroy(&coarse_mat_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8297
8298 /* create local to global scatters for coarse problem */
8299 if (compute_vecs) {
8300 PetscInt lrows;
8301 ierr = VecDestroy(&pcbddc->coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8301,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8302 if (coarse_mat) {
8303 ierr = MatGetLocalSize(coarse_mat,&lrows,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8303,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8304 } else {
8305 lrows = 0;
8306 }
8307 ierr = VecCreate(PetscObjectComm((PetscObject)pc),&pcbddc->coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8307,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8308 ierr = VecSetSizes(pcbddc->coarse_vec,lrows,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8308,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8309 ierr = VecSetType(pcbddc->coarse_vec,coarse_mat ? coarse_mat->defaultvectype : VECSTANDARD"standard");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8309,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8310 ierr = VecScatterDestroy(&pcbddc->coarse_loc_to_glob);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8310,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8311 ierr = VecScatterCreate(pcbddc->vec1_P,NULL((void*)0),pcbddc->coarse_vec,coarse_is,&pcbddc->coarse_loc_to_glob);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8311,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8312 }
8313 ierr = ISDestroy(&coarse_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8313,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8314
8315 /* set defaults for coarse KSP and PC */
8316 if (multilevel_allowed) {
8317 coarse_ksp_type = KSPRICHARDSON"richardson";
8318 coarse_pc_type = PCBDDC"bddc";
8319 } else {
8320 coarse_ksp_type = KSPPREONLY"preonly";
8321 coarse_pc_type = PCREDUNDANT"redundant";
8322 }
8323
8324 /* print some info if requested */
8325 if (pcbddc->dbg_flag) {
8326 if (!multilevel_allowed) {
8327 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8327,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8328 if (multilevel_requested) {
8329 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Not enough active processes on level %D (active processes %D, coarsening ratio %D)\n",pcbddc->current_level,active_procs,pcbddc->coarsening_ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8329,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8330 } else if (pcbddc->max_levels) {
8331 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Maximum number of requested levels reached (%D)\n",pcbddc->max_levels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8331,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8332 }
8333 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8333,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8334 }
8335 }
8336
8337 /* communicate coarse discrete gradient */
8338 coarseG = NULL((void*)0);
8339 if (pcbddc->nedcG && multilevel_allowed) {
8340 MPI_Comm ccomm;
8341 if (coarse_mat) {
8342 ccomm = PetscObjectComm((PetscObject)coarse_mat);
8343 } else {
8344 ccomm = MPI_COMM_NULL((MPI_Comm)0x04000000);
8345 }
8346 ierr = MatMPIAIJRestrict(pcbddc->nedcG,ccomm,&coarseG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8346,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8347 }
8348
8349 /* create the coarse KSP object only once with defaults */
8350 if (coarse_mat) {
8351 PetscBool isredundant,isnn,isbddc;
8352 PetscViewer dbg_viewer = NULL((void*)0);
8353
8354 if (pcbddc->dbg_flag) {
8355 dbg_viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)coarse_mat));
8356 ierr = PetscViewerASCIIAddTab(dbg_viewer,2*pcbddc->current_level);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8357 }
8358 if (!pcbddc->coarse_ksp) {
8359 char prefix[256],str_level[16];
8360 size_t len;
8361
8362 ierr = KSPCreate(PetscObjectComm((PetscObject)coarse_mat),&pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8362,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8363 ierr = KSPSetErrorIfNotConverged(pcbddc->coarse_ksp,pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8363,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8364 ierr = PetscObjectIncrementTabLevel((PetscObject)pcbddc->coarse_ksp,(PetscObject)pc,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8365 ierr = KSPSetTolerances(pcbddc->coarse_ksp,PETSC_DEFAULT-2,PETSC_DEFAULT-2,PETSC_DEFAULT-2,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8365,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8366 ierr = KSPSetOperators(pcbddc->coarse_ksp,coarse_mat,coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8366,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8367 ierr = KSPSetType(pcbddc->coarse_ksp,coarse_ksp_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8367,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8368 ierr = KSPSetNormType(pcbddc->coarse_ksp,KSP_NORM_NONE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8368,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8369 ierr = KSPGetPC(pcbddc->coarse_ksp,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8370 /* TODO is this logic correct? should check for coarse_mat type */
8371 ierr = PCSetType(pc_temp,coarse_pc_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8371,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8372 /* prefix */
8373 ierr = PetscStrcpy(prefix,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8374 ierr = PetscStrcpy(str_level,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8374,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8375 if (!pcbddc->current_level) {
8376 ierr = PetscStrncpy(prefix,((PetscObject)pc)->prefix,sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8377 ierr = PetscStrlcat(prefix,"pc_bddc_coarse_",sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8377,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8378 } else {
8379 ierr = PetscStrlen(((PetscObject)pc)->prefix,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8379,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8380 if (pcbddc->current_level>1) len -= 3; /* remove "lX_" with X level number */
8381 if (pcbddc->current_level>10) len -= 1; /* remove another char from level number */
8382 /* Nonstandard use of PetscStrncpy() to copy only a portion of the string */
8383 ierr = PetscStrncpy(prefix,((PetscObject)pc)->prefix,len+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8383,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8384 ierr = PetscSNPrintf(str_level,sizeof(str_level),"l%d_",(int)(pcbddc->current_level));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8384,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8385 ierr = PetscStrlcat(prefix,str_level,sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8385,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8386 }
8387 ierr = KSPSetOptionsPrefix(pcbddc->coarse_ksp,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8387,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8388 /* propagate BDDC info to the next level (these are dummy calls if pc_temp is not of type PCBDDC) */
8389 ierr = PCBDDCSetLevel(pc_temp,pcbddc->current_level+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8389,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8390 ierr = PCBDDCSetCoarseningRatio(pc_temp,pcbddc->coarsening_ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8391 ierr = PCBDDCSetLevels(pc_temp,pcbddc->max_levels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8391,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8392 /* allow user customization */
8393 ierr = KSPSetFromOptions(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8393,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8394 /* get some info after set from options */
8395 ierr = KSPGetPC(pcbddc->coarse_ksp,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8395,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8396 /* multilevel cannot be done with coarse PCs different from BDDC or NN */
8397 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8397,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8398 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCNN"nn",&isnn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8398,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8399 if (multilevel_allowed && !isbddc && !isnn) {
8400 isbddc = PETSC_TRUE;
8401 ierr = PCSetType(pc_temp,PCBDDC"bddc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8401,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8402 ierr = PCBDDCSetLevel(pc_temp,pcbddc->current_level+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8402,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8403 ierr = PCBDDCSetCoarseningRatio(pc_temp,pcbddc->coarsening_ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8403,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8404 ierr = PCBDDCSetLevels(pc_temp,pcbddc->max_levels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8404,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8405 if (pc_temp->ops->setfromoptions) { /* need to setfromoptions again, skipping the pc_type */
8406 ierr = PetscObjectOptionsBegin((PetscObject)pc_temp)0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems
*PetscOptionsObject = &PetscOptionsObjectBase; PetscOptionsObject
->options = ((PetscObject)(PetscObject)pc_temp)->options
; for (PetscOptionsObject->count=(PetscOptionsPublish?-1:1
); PetscOptionsObject->count<2; PetscOptionsObject->
count++) { PetscErrorCode _5_ierr = PetscObjectOptionsBegin_Private
(PetscOptionsObject,(PetscObject)pc_temp);do {if (__builtin_expect
(!!(_5_ierr),0)) return PetscError(((MPI_Comm)0x44000001),8406
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8406,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8407 ierr = (*pc_temp->ops->setfromoptions)(PetscOptionsObject,pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8407,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8408 ierr = PetscObjectProcessOptionsHandlers(PetscOptionsObject,(PetscObject)pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8408,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8409 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8410 pc_temp->setfromoptionscalled++;
8411 }
8412 }
8413 }
8414 /* propagate BDDC info to the next level (these are dummy calls if pc_temp is not of type PCBDDC) */
8415 ierr = KSPGetPC(pcbddc->coarse_ksp,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8415,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8416 if (nisdofs) {
8417 ierr = PCBDDCSetDofsSplitting(pc_temp,nisdofs,isarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8417,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8418 for (i=0;i<nisdofs;i++) {
8419 ierr = ISDestroy(&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8419,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8420 }
8421 }
8422 if (nisneu) {
8423 ierr = PCBDDCSetNeumannBoundaries(pc_temp,isarray[nisdofs]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8423,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8424 ierr = ISDestroy(&isarray[nisdofs]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8425 }
8426 if (nisvert) {
8427 ierr = PCBDDCSetPrimalVerticesIS(pc_temp,isarray[nis-1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8427,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8428 ierr = ISDestroy(&isarray[nis-1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8429 }
8430 if (coarseG) {
8431 ierr = PCBDDCSetDiscreteGradient(pc_temp,coarseG,1,nedcfield,PETSC_FALSE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8431,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8432 }
8433
8434 /* get some info after set from options */
8435 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8435,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8436
8437 /* multilevel can only be requested via -pc_bddc_levels or PCBDDCSetLevels */
8438 if (isbddc && !multilevel_allowed) {
8439 ierr = PCSetType(pc_temp,coarse_pc_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8439,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8440 isbddc = PETSC_FALSE;
8441 }
8442 /* multilevel cannot be done with coarse PCs different from BDDC or NN */
8443 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCNN"nn",&isnn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8443,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8444 if (multilevel_requested && multilevel_allowed && !isbddc && !isnn) {
8445 ierr = PCSetType(pc_temp,PCBDDC"bddc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8445,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8446 isbddc = PETSC_TRUE;
8447 }
8448 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCREDUNDANT"redundant",&isredundant);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8448,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8449 if (isredundant) {
8450 KSP inner_ksp;
8451 PC inner_pc;
8452
8453 ierr = PCRedundantGetKSP(pc_temp,&inner_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8453,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8454 ierr = KSPGetPC(inner_ksp,&inner_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8454,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8455 }
8456
8457 /* parameters which miss an API */
8458 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8458,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8459 if (isbddc) {
8460 PC_BDDC* pcbddc_coarse = (PC_BDDC*)pc_temp->data;
8461
8462 pcbddc_coarse->detect_disconnected = PETSC_TRUE;
8463 pcbddc_coarse->coarse_eqs_per_proc = pcbddc->coarse_eqs_per_proc;
8464 pcbddc_coarse->coarse_eqs_limit = pcbddc->coarse_eqs_limit;
8465 pcbddc_coarse->benign_saddle_point = pcbddc->benign_have_null;
8466 if (pcbddc_coarse->benign_saddle_point) {
8467 Mat coarsedivudotp_is;
8468 ISLocalToGlobalMapping l2gmap,rl2g,cl2g;
8469 IS row,col;
8470 const PetscInt *gidxs;
8471 PetscInt n,st,M,N;
8472
8473 ierr = MatGetSize(coarsedivudotp,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8473,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8474 ierr = MPI_Scan(&n,&st,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),PetscObjectComm((PetscObject)coarse_mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8474,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8475 st = st-n;
8476 ierr = ISCreateStride(PetscObjectComm((PetscObject)coarse_mat),1,st,1,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8476,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8477 ierr = MatGetLocalToGlobalMapping(coarse_mat,&l2gmap,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8477,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8478 ierr = ISLocalToGlobalMappingGetSize(l2gmap,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8478,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8479 ierr = ISLocalToGlobalMappingGetIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8479,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8480 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)coarse_mat),n,gidxs,PETSC_COPY_VALUES,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8480,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8481 ierr = ISLocalToGlobalMappingRestoreIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8481,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8482 ierr = ISLocalToGlobalMappingCreateIS(row,&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8482,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8483 ierr = ISLocalToGlobalMappingCreateIS(col,&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8483,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8484 ierr = ISGetSize(row,&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8484,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8485 ierr = MatGetSize(coarse_mat,&N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8485,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8486 ierr = ISDestroy(&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8487 ierr = ISDestroy(&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8488 ierr = MatCreate(PetscObjectComm((PetscObject)coarse_mat),&coarsedivudotp_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8488,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8489 ierr = MatSetType(coarsedivudotp_is,MATIS"is");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8490 ierr = MatSetSizes(coarsedivudotp_is,PETSC_DECIDE-1,PETSC_DECIDE-1,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8490,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8491 ierr = MatSetLocalToGlobalMapping(coarsedivudotp_is,rl2g,cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8491,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8492 ierr = ISLocalToGlobalMappingDestroy(&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8492,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8493 ierr = ISLocalToGlobalMappingDestroy(&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8493,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8494 ierr = MatISSetLocalMat(coarsedivudotp_is,coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8494,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8495 ierr = MatDestroy(&coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8495,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8496 ierr = PCBDDCSetDivergenceMat(pc_temp,coarsedivudotp_is,PETSC_FALSE,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8497 ierr = MatDestroy(&coarsedivudotp_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8498 pcbddc_coarse->adaptive_userdefined = PETSC_TRUE;
8499 if (pcbddc->adaptive_threshold[0] == 0.0) pcbddc_coarse->deluxe_zerorows = PETSC_TRUE;
8500 }
8501 }
8502
8503 /* propagate symmetry info of coarse matrix */
8504 ierr = MatSetOption(coarse_mat,MAT_STRUCTURALLY_SYMMETRIC,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8504,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8505 if (pc->pmat->symmetric_set) {
8506 ierr = MatSetOption(coarse_mat,MAT_SYMMETRIC,pc->pmat->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8506,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8507 }
8508 if (pc->pmat->hermitian_set) {
8509 ierr = MatSetOption(coarse_mat,MAT_HERMITIAN,pc->pmat->hermitian);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8510 }
8511 if (pc->pmat->spd_set) {
8512 ierr = MatSetOption(coarse_mat,MAT_SPD,pc->pmat->spd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8512,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8513 }
8514 if (pcbddc->benign_saddle_point && !pcbddc->benign_have_null) {
8515 ierr = MatSetOption(coarse_mat,MAT_SPD,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8515,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8516 }
8517 /* set operators */
8518 ierr = MatViewFromOptions(coarse_mat,(PetscObject)pc,"-pc_bddc_coarse_mat_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8518,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8519 ierr = MatSetOptionsPrefix(coarse_mat,((PetscObject)pcbddc->coarse_ksp)->prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8519,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8520 ierr = KSPSetOperators(pcbddc->coarse_ksp,coarse_mat,coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8520,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8521 if (pcbddc->dbg_flag) {
8522 ierr = PetscViewerASCIISubtractTab(dbg_viewer,2*pcbddc->current_level);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8523 }
8524 }
8525 ierr = MatDestroy(&coarseG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8525,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8526 ierr = PetscFree(isarray)((*PetscTrFree)((void*)(isarray),8526,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((isarray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8526,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8527#if 0
8528 {
8529 PetscViewer viewer;
8530 char filename[256];
8531 sprintf(filename,"coarse_mat_level%d.m",pcbddc->current_level);
8532 ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)coarse_mat),filename,&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8532,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8533 ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8533,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8534 ierr = MatView(coarse_mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8534,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8535 ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8535,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8536 ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8536,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8537 }
8538#endif
8539
8540 if (corners) {
8541 Vec gv;
8542 IS is;
8543 const PetscInt *idxs;
8544 PetscInt i,d,N,n,cdim = pcbddc->mat_graph->cdim;
8545 PetscScalar *coords;
8546
8547 if (!pcbddc->mat_graph->cloc) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Missing local coordinates")return PetscError(((MPI_Comm)0x44000001),8547,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Missing local coordinates")
;
8548 ierr = VecGetSize(pcbddc->coarse_vec,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8548,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8549 ierr = VecGetLocalSize(pcbddc->coarse_vec,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8549,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8550 ierr = VecCreate(PetscObjectComm((PetscObject)pcbddc->coarse_vec),&gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8550,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8551 ierr = VecSetBlockSize(gv,cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8552 ierr = VecSetSizes(gv,n*cdim,N*cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8553 ierr = VecSetType(gv,VECSTANDARD"standard");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8553,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8554 ierr = VecSetFromOptions(gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8554,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8555 ierr = VecSet(gv,PETSC_MAX_REAL1.7976931348623157e+308);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8555,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* we only propagate coordinates from vertices constraints */
8556
8557 ierr = PCBDDCGraphGetCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8557,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8558 ierr = ISGetLocalSize(is,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8558,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8559 ierr = ISGetIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8559,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8560 ierr = PetscMalloc1(n*cdim,&coords)PetscMallocA(1,PETSC_FALSE,8560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n*cdim)*sizeof(**(&coords)),(&coords))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8560,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8561 for (i=0;i<n;i++) {
8562 for (d=0;d<cdim;d++) {
8563 coords[cdim*i+d] = pcbddc->mat_graph->coords[cdim*idxs[i]+d];
8564 }
8565 }
8566 ierr = ISRestoreIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8566,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8567 ierr = PCBDDCGraphRestoreCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8567,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8568
8569 ierr = ISGetLocalSize(corners,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8569,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8570 ierr = ISGetIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8570,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8571 ierr = VecSetValuesBlocked(gv,n,idxs,coords,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8571,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8572 ierr = ISRestoreIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8572,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8573 ierr = PetscFree(coords)((*PetscTrFree)((void*)(coords),8573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((coords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8573,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8574 ierr = VecAssemblyBegin(gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8574,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8575 ierr = VecAssemblyEnd(gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8575,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8576 ierr = VecGetArray(gv,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8576,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8577 if (pcbddc->coarse_ksp) {
8578 PC coarse_pc;
8579 PetscBool isbddc;
8580
8581 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8581,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8582 ierr = PetscObjectTypeCompare((PetscObject)coarse_pc,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8582,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8583 if (isbddc) { /* coarse coordinates have PETSC_MAX_REAL, specific for BDDC */
8584 PetscReal *realcoords;
8585
8586 ierr = VecGetLocalSize(gv,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8586,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8587#if defined(PETSC_USE_COMPLEX)
8588 ierr = PetscMalloc1(n,&realcoords)PetscMallocA(1,PETSC_FALSE,8588,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(n)*sizeof(**(&realcoords)),(&realcoords))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8588,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8589 for (i=0;i<n;i++) realcoords[i] = PetscRealPart(coords[i])(coords[i]);
8590#else
8591 realcoords = coords;
8592#endif
8593 ierr = PCSetCoordinates(coarse_pc,cdim,n/cdim,realcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8593,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8594#if defined(PETSC_USE_COMPLEX)
8595 ierr = PetscFree(realcoords)((*PetscTrFree)((void*)(realcoords),8595,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((realcoords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8595,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8596#endif
8597 }
8598 }
8599 ierr = VecRestoreArray(gv,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8599,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8600 ierr = VecDestroy(&gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8600,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8601 }
8602 ierr = ISDestroy(&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8602,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8603
8604 if (pcbddc->coarse_ksp) {
8605 Vec crhs,csol;
8606
8607 ierr = KSPGetSolution(pcbddc->coarse_ksp,&csol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8607,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8608 ierr = KSPGetRhs(pcbddc->coarse_ksp,&crhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8608,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8609 if (!csol) {
8610 ierr = MatCreateVecs(coarse_mat,&((pcbddc->coarse_ksp)->vec_sol),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8610,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8611 }
8612 if (!crhs) {
8613 ierr = MatCreateVecs(coarse_mat,NULL((void*)0),&((pcbddc->coarse_ksp)->vec_rhs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8613,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8614 }
8615 }
8616 ierr = MatDestroy(&coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8616,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8617
8618 /* compute null space for coarse solver if the benign trick has been requested */
8619 if (pcbddc->benign_null) {
8620
8621 ierr = VecSet(pcbddc->vec1_P,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8621,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8622 for (i=0;i<pcbddc->benign_n;i++) {
8623 ierr = VecSetValue(pcbddc->vec1_P,pcbddc->local_primal_size-pcbddc->benign_n+i,1.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8623,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8624 }
8625 ierr = VecAssemblyBegin(pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8625,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8626 ierr = VecAssemblyEnd(pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8626,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8627 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,pcbddc->vec1_P,pcbddc->coarse_vec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8627,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8628 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,pcbddc->vec1_P,pcbddc->coarse_vec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8628,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8629 if (coarse_mat) {
8630 Vec nullv;
8631 PetscScalar *array,*array2;
8632 PetscInt nl;
8633
8634 ierr = MatCreateVecs(coarse_mat,&nullv,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8634,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8635 ierr = VecGetLocalSize(nullv,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8635,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8636 ierr = VecGetArrayRead(pcbddc->coarse_vec,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8637 ierr = VecGetArray(nullv,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8637,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8638 ierr = PetscMemcpy(array2,array,nl*sizeof(*array));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8638,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8639 ierr = VecRestoreArray(nullv,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8639,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8640 ierr = VecRestoreArrayRead(pcbddc->coarse_vec,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8640,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8641 ierr = VecNormalize(nullv,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8641,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8642 ierr = MatNullSpaceCreate(PetscObjectComm((PetscObject)coarse_mat),PETSC_FALSE,1,&nullv,&CoarseNullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8642,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8643 ierr = VecDestroy(&nullv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8643,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8644 }
8645 }
8646 ierr = PetscLogEventEnd(PC_BDDC_CoarseSetUp[pcbddc->current_level],pc,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_CoarseSetUp[pcbddc->current_level]].active) ? (*PetscLogPLE
)((PC_BDDC_CoarseSetUp[pcbddc->current_level]),0,(PetscObject
)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject)(0)) : 0
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8646,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8647
8648 ierr = PetscLogEventBegin(PC_BDDC_CoarseSolver[pcbddc->current_level],pc,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_CoarseSolver[pcbddc->current_level]].active) ? (*
PetscLogPLB)((PC_BDDC_CoarseSolver[pcbddc->current_level])
,0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8648,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8649 if (pcbddc->coarse_ksp) {
8650 PetscBool ispreonly;
8651
8652 if (CoarseNullSpace) {
8653 PetscBool isnull;
8654 ierr = MatNullSpaceTest(CoarseNullSpace,coarse_mat,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8654,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8655 if (isnull) {
8656 ierr = MatSetNullSpace(coarse_mat,CoarseNullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8656,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8657 }
8658 /* TODO: add local nullspaces (if any) */
8659 }
8660 /* setup coarse ksp */
8661 ierr = KSPSetUp(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8661,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8662 /* Check coarse problem if in debug mode or if solving with an iterative method */
8663 ierr = PetscObjectTypeCompare((PetscObject)pcbddc->coarse_ksp,KSPPREONLY"preonly",&ispreonly);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8663,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8664 if (pcbddc->dbg_flag || (!ispreonly && pcbddc->use_coarse_estimates) ) {
8665 KSP check_ksp;
8666 KSPType check_ksp_type;
8667 PC check_pc;
8668 Vec check_vec,coarse_vec;
8669 PetscReal abs_infty_error,infty_error,lambda_min=1.0,lambda_max=1.0;
8670 PetscInt its;
8671 PetscBool compute_eigs;
8672 PetscReal *eigs_r,*eigs_c;
8673 PetscInt neigs;
8674 const char *prefix;
8675
8676 /* Create ksp object suitable for estimation of extreme eigenvalues */
8677 ierr = KSPCreate(PetscObjectComm((PetscObject)pcbddc->coarse_ksp),&check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8677,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8678 ierr = PetscObjectIncrementTabLevel((PetscObject)check_ksp,(PetscObject)pcbddc->coarse_ksp,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8678,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8679 ierr = KSPSetErrorIfNotConverged(pcbddc->coarse_ksp,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8679,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8680 ierr = KSPSetOperators(check_ksp,coarse_mat,coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8680,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8681 ierr = KSPSetTolerances(check_ksp,1.e-12,1.e-12,PETSC_DEFAULT-2,pcbddc->coarse_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8681,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8682 /* prevent from setup unneeded object */
8683 ierr = KSPGetPC(check_ksp,&check_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8683,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8684 ierr = PCSetType(check_pc,PCNONE"none");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8684,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8685 if (ispreonly) {
8686 check_ksp_type = KSPPREONLY"preonly";
8687 compute_eigs = PETSC_FALSE;
8688 } else {
8689 check_ksp_type = KSPGMRES"gmres";
8690 compute_eigs = PETSC_TRUE;
8691 }
8692 ierr = KSPSetType(check_ksp,check_ksp_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8692,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8693 ierr = KSPSetComputeSingularValues(check_ksp,compute_eigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8694 ierr = KSPSetComputeEigenvalues(check_ksp,compute_eigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8694,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8695 ierr = KSPGMRESSetRestart(check_ksp,pcbddc->coarse_size+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8695,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8696 ierr = KSPGetOptionsPrefix(pcbddc->coarse_ksp,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8696,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8697 ierr = KSPSetOptionsPrefix(check_ksp,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8697,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8698 ierr = KSPAppendOptionsPrefix(check_ksp,"check_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8698,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8699 ierr = KSPSetFromOptions(check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8700 ierr = KSPSetUp(check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8700,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8701 ierr = KSPGetPC(pcbddc->coarse_ksp,&check_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8701,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8702 ierr = KSPSetPC(check_ksp,check_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8702,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8703 /* create random vec */
8704 ierr = MatCreateVecs(coarse_mat,&coarse_vec,&check_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8705 ierr = VecSetRandom(check_vec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8705,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8706 ierr = MatMult(coarse_mat,check_vec,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8706,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8707 /* solve coarse problem */
8708 ierr = KSPSolve(check_ksp,coarse_vec,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8708,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8709 ierr = KSPCheckSolve(check_ksp,pc,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8709,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8710 /* set eigenvalue estimation if preonly has not been requested */
8711 if (compute_eigs) {
8712 ierr = PetscMalloc1(pcbddc->coarse_size+1,&eigs_r)PetscMallocA(1,PETSC_FALSE,8712,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->coarse_size+1)*sizeof(**(&eigs_r)),(
&eigs_r))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8712,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8713 ierr = PetscMalloc1(pcbddc->coarse_size+1,&eigs_c)PetscMallocA(1,PETSC_FALSE,8713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->coarse_size+1)*sizeof(**(&eigs_c)),(
&eigs_c))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8713,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8714 ierr = KSPComputeEigenvalues(check_ksp,pcbddc->coarse_size+1,eigs_r,eigs_c,&neigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8714,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8715 if (neigs) {
8716 lambda_max = eigs_r[neigs-1];
8717 lambda_min = eigs_r[0];
8718 if (pcbddc->use_coarse_estimates) {
8719 if (lambda_max>=lambda_min) { /* using PETSC_SMALL since lambda_max == lambda_min is not allowed by KSPChebyshevSetEigenvalues */
8720 ierr = KSPChebyshevSetEigenvalues(pcbddc->coarse_ksp,lambda_max+PETSC_SMALL1.e-10,lambda_min);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8720,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8721 ierr = KSPRichardsonSetScale(pcbddc->coarse_ksp,2.0/(lambda_max+lambda_min));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8721,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8722 }
8723 }
8724 }
8725 }
8726
8727 /* check coarse problem residual error */
8728 if (pcbddc->dbg_flag) {
8729 PetscViewer dbg_viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)pcbddc->coarse_ksp));
8730 ierr = PetscViewerASCIIAddTab(dbg_viewer,2*(pcbddc->current_level+1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8730,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8731 ierr = VecAXPY(check_vec,-1.0,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8731,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8732 ierr = VecNorm(check_vec,NORM_INFINITY,&infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8732,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8733 ierr = MatMult(coarse_mat,check_vec,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8733,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8734 ierr = VecNorm(coarse_vec,NORM_INFINITY,&abs_infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8734,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8735 ierr = PetscViewerASCIIPrintf(dbg_viewer,"Coarse problem details (use estimates %d)\n",pcbddc->use_coarse_estimates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8735,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8736 ierr = PetscObjectPrintClassNamePrefixType((PetscObject)(pcbddc->coarse_ksp),dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8736,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8737 ierr = PetscObjectPrintClassNamePrefixType((PetscObject)(check_pc),dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8737,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8738 ierr = PetscViewerASCIIPrintf(dbg_viewer,"Coarse problem exact infty_error : %1.6e\n",infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8738,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8739 ierr = PetscViewerASCIIPrintf(dbg_viewer,"Coarse problem residual infty_error: %1.6e\n",abs_infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8739,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8740 if (CoarseNullSpace) {
8741 ierr = PetscViewerASCIIPrintf(dbg_viewer,"Coarse problem is singular\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8741,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8742 }
8743 if (compute_eigs) {
8744 PetscReal lambda_max_s,lambda_min_s;
8745 KSPConvergedReason reason;
8746 ierr = KSPGetType(check_ksp,&check_ksp_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8746,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8747 ierr = KSPGetIterationNumber(check_ksp,&its);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8747,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8748 ierr = KSPGetConvergedReason(check_ksp,&reason);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8749 ierr = KSPComputeExtremeSingularValues(check_ksp,&lambda_max_s,&lambda_min_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8750 ierr = PetscViewerASCIIPrintf(dbg_viewer,"Coarse problem eigenvalues (estimated with %d iterations of %s, conv reason %d): %1.6e %1.6e (%1.6e %1.6e)\n",its,check_ksp_type,reason,lambda_min,lambda_max,lambda_min_s,lambda_max_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8751 for (i=0;i<neigs;i++) {
8752 ierr = PetscViewerASCIIPrintf(dbg_viewer,"%1.6e %1.6ei\n",eigs_r[i],eigs_c[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8752,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8753 }
8754 }
8755 ierr = PetscViewerFlush(dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8755,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8756 ierr = PetscViewerASCIISubtractTab(dbg_viewer,2*(pcbddc->current_level+1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8756,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8757 }
8758 ierr = VecDestroy(&check_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8758,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8759 ierr = VecDestroy(&coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8759,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8760 ierr = KSPDestroy(&check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8760,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8761 if (compute_eigs) {
8762 ierr = PetscFree(eigs_r)((*PetscTrFree)((void*)(eigs_r),8762,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eigs_r) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8762,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8763 ierr = PetscFree(eigs_c)((*PetscTrFree)((void*)(eigs_c),8763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eigs_c) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8763,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8764 }
8765 }
8766 }
8767 ierr = MatNullSpaceDestroy(&CoarseNullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8767,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8768 /* print additional info */
8769 if (pcbddc->dbg_flag) {
8770 /* waits until all processes reaches this point */
8771 ierr = PetscBarrier((PetscObject)pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8771,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8772 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Coarse solver setup completed at level %D\n",pcbddc->current_level);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8772,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8773 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8773,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8774 }
8775
8776 /* free memory */
8777 ierr = MatDestroy(&coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8777,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8778 ierr = PetscLogEventEnd(PC_BDDC_CoarseSolver[pcbddc->current_level],pc,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_CoarseSolver[pcbddc->current_level]].active) ? (*
PetscLogPLE)((PC_BDDC_CoarseSolver[pcbddc->current_level])
,0,(PetscObject)(pc),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8778,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8779 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
8780}
8781
8782PetscErrorCode PCBDDCComputePrimalNumbering(PC pc,PetscInt* coarse_size_n,PetscInt** local_primal_indices_n)
8783{
8784 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
8785 PC_IS* pcis = (PC_IS*)pc->data;
8786 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
8787 IS subset,subset_mult,subset_n;
8788 PetscInt local_size,coarse_size=0;
8789 PetscInt *local_primal_indices=NULL((void*)0);
8790 const PetscInt *t_local_primal_indices;
8791 PetscErrorCode ierr;
8792
8793 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8793; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8794 /* Compute global number of coarse dofs */
8795 if (pcbddc->local_primal_size && !pcbddc->local_primal_ref_node) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"BDDC ConstraintsSetUp should be called first")return PetscError(((MPI_Comm)0x44000001),8795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"BDDC ConstraintsSetUp should be called first"
)
;
8796 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)(pc->pmat)),pcbddc->local_primal_size_cc,pcbddc->local_primal_ref_node,PETSC_COPY_VALUES,&subset_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8796,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8797 ierr = ISLocalToGlobalMappingApplyIS(pcis->mapping,subset_n,&subset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8797,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8798 ierr = ISDestroy(&subset_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8798,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8799 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)(pc->pmat)),pcbddc->local_primal_size_cc,pcbddc->local_primal_ref_mult,PETSC_COPY_VALUES,&subset_mult);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8799,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8800 ierr = ISRenumber(subset,subset_mult,&coarse_size,&subset_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8800,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8801 ierr = ISDestroy(&subset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8801,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8802 ierr = ISDestroy(&subset_mult);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8802,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8803 ierr = ISGetLocalSize(subset_n,&local_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8803,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8804 if (local_size != pcbddc->local_primal_size) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Invalid number of local primal indices computed %D != %D",local_size,pcbddc->local_primal_size)return PetscError(((MPI_Comm)0x44000001),8804,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Invalid number of local primal indices computed %D != %D"
,local_size,pcbddc->local_primal_size)
;
8805 ierr = PetscMalloc1(local_size,&local_primal_indices)PetscMallocA(1,PETSC_FALSE,8805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(local_size)*sizeof(**(&local_primal_indices)),(
&local_primal_indices))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8805,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8806 ierr = ISGetIndices(subset_n,&t_local_primal_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8806,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8807 ierr = PetscMemcpy(local_primal_indices,t_local_primal_indices,local_size*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8807,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8808 ierr = ISRestoreIndices(subset_n,&t_local_primal_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8808,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8809 ierr = ISDestroy(&subset_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8809,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8810
8811 /* check numbering */
8812 if (pcbddc->dbg_flag) {
8813 PetscScalar coarsesum,*array,*array2;
8814 PetscInt i;
8815 PetscBool set_error = PETSC_FALSE,set_error_reduced = PETSC_FALSE;
8816
8817 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8817,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8818 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8818,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8819 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Check coarse indices\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8819,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8820 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8820,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8821 /* counter */
8822 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8822,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8823 ierr = VecSet(pcis->vec1_N,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8823,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8824 ierr = VecScatterBegin(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8824,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8825 ierr = VecScatterEnd(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8825,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8826 ierr = VecScatterBegin(matis->rctx,pcis->vec1_global,pcis->vec2_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8826,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8827 ierr = VecScatterEnd(matis->rctx,pcis->vec1_global,pcis->vec2_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8827,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8828 ierr = VecSet(pcis->vec1_N,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8828,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8829 for (i=0;i<pcbddc->local_primal_size;i++) {
8830 ierr = VecSetValue(pcis->vec1_N,pcbddc->primal_indices_local_idxs[i],1.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8830,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8831 }
8832 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8832,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8833 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8833,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8834 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8834,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8835 ierr = VecScatterBegin(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8835,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8836 ierr = VecScatterEnd(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8836,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8837 ierr = VecScatterBegin(matis->rctx,pcis->vec1_global,pcis->vec1_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8837,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8838 ierr = VecScatterEnd(matis->rctx,pcis->vec1_global,pcis->vec1_N,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8838,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8839 ierr = VecGetArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8839,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8840 ierr = VecGetArray(pcis->vec2_N,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8840,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8841 for (i=0;i<pcis->n;i++) {
8842 if (array[i] != 0.0 && array[i] != array2[i]) {
8843 PetscInt owned = (PetscInt)PetscRealPart(array[i])(array[i]),gi;
8844 PetscInt neigh = (PetscInt)PetscRealPart(array2[i])(array2[i]);
8845 set_error = PETSC_TRUE;
8846 ierr = ISLocalToGlobalMappingApply(pcis->mapping,1,&i,&gi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8846,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8847 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d: local index %D (gid %D) owned by %D processes instead of %D!\n",PetscGlobalRank,i,gi,owned,neigh);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8847,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8848 }
8849 }
8850 ierr = VecRestoreArray(pcis->vec2_N,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8850,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8851 ierr = MPIU_Allreduce(&set_error,&set_error_reduced,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8851,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&set_error),(&
set_error_reduced),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(PetscObjectComm
((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8851,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8852 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8852,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8853 for (i=0;i<pcis->n;i++) {
8854 if (PetscRealPart(array[i])(array[i]) > 0.0) array[i] = 1.0/PetscRealPart(array[i])(array[i]);
8855 }
8856 ierr = VecRestoreArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8856,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8857 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8857,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8858 ierr = VecScatterBegin(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8858,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8859 ierr = VecScatterEnd(matis->rctx,pcis->vec1_N,pcis->vec1_global,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8859,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8860 ierr = VecSum(pcis->vec1_global,&coarsesum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8860,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8861 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Size of coarse problem is %D (%lf)\n",coarse_size,PetscRealPart(coarsesum)(coarsesum));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8861,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8862 if (pcbddc->dbg_flag > 1 || set_error_reduced) {
8863 PetscInt *gidxs;
8864
8865 ierr = PetscMalloc1(pcbddc->local_primal_size,&gidxs)PetscMallocA(1,PETSC_FALSE,8865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->local_primal_size)*sizeof(**(&gidxs)
),(&gidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8865,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8866 ierr = ISLocalToGlobalMappingApply(pcis->mapping,pcbddc->local_primal_size,pcbddc->primal_indices_local_idxs,gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8866,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8867 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Distribution of local primal indices\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8867,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8868 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8868,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8869 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d\n",PetscGlobalRank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8869,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8870 for (i=0;i<pcbddc->local_primal_size;i++) {
8871 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"local_primal_indices[%D]=%D (%D,%D)\n",i,local_primal_indices[i],pcbddc->primal_indices_local_idxs[i],gidxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8871,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8872 }
8873 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8873,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8874 ierr = PetscFree(gidxs)((*PetscTrFree)((void*)(gidxs),8874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((gidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8874,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8875 }
8876 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8876,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8877 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8877,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8878 if (set_error_reduced) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"BDDC Numbering of coarse dofs failed")return PetscError(PetscObjectComm((PetscObject)pc),8878,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"BDDC Numbering of coarse dofs failed"
)
;
8879 }
8880
8881 /* get back data */
8882 *coarse_size_n = coarse_size;
8883 *local_primal_indices_n = local_primal_indices;
8884 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
8885}
8886
8887PetscErrorCode PCBDDCGlobalToLocal(VecScatter g2l_ctx,Vec gwork, Vec lwork, IS globalis, IS* localis)
8888{
8889 IS localis_t;
8890 PetscInt i,lsize,*idxs,n;
8891 PetscScalar *vals;
8892 PetscErrorCode ierr;
8893
8894 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8894; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8895 /* get indices in local ordering exploiting local to global map */
8896 ierr = ISGetLocalSize(globalis,&lsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8896,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8897 ierr = PetscMalloc1(lsize,&vals)PetscMallocA(1,PETSC_FALSE,8897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(lsize)*sizeof(**(&vals)),(&vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8897,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8898 for (i=0;i<lsize;i++) vals[i] = 1.0;
8899 ierr = ISGetIndices(globalis,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8899,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8900 ierr = VecSet(gwork,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8900,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8901 ierr = VecSet(lwork,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8901,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8902 if (idxs) { /* multilevel guard */
8903 ierr = VecSetOption(gwork,VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8903,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8904 ierr = VecSetValues(gwork,lsize,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8904,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8905 }
8906 ierr = VecAssemblyBegin(gwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8906,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8907 ierr = ISRestoreIndices(globalis,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8907,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8908 ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),8908,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8908,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8909 ierr = VecAssemblyEnd(gwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8909,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8910 /* now compute set in local ordering */
8911 ierr = VecScatterBegin(g2l_ctx,gwork,lwork,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8911,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8912 ierr = VecScatterEnd(g2l_ctx,gwork,lwork,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8912,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8913 ierr = VecGetArrayRead(lwork,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8913,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8914 ierr = VecGetSize(lwork,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8914,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8915 for (i=0,lsize=0;i<n;i++) {
8916 if (PetscRealPart(vals[i])(vals[i]) > 0.5) {
8917 lsize++;
8918 }
8919 }
8920 ierr = PetscMalloc1(lsize,&idxs)PetscMallocA(1,PETSC_FALSE,8920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(lsize)*sizeof(**(&idxs)),(&idxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8920,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8921 for (i=0,lsize=0;i<n;i++) {
8922 if (PetscRealPart(vals[i])(vals[i]) > 0.5) {
8923 idxs[lsize++] = i;
8924 }
8925 }
8926 ierr = VecRestoreArrayRead(lwork,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8926,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8927 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)gwork),lsize,idxs,PETSC_OWN_POINTER,&localis_t);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8927,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8928 *localis = localis_t;
8929 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
8930}
8931
8932PetscErrorCode PCBDDCSetUpSubSchurs(PC pc)
8933{
8934 PC_IS *pcis=(PC_IS*)pc->data;
8935 PC_BDDC *pcbddc=(PC_BDDC*)pc->data;
8936 PCBDDCSubSchurs sub_schurs=pcbddc->sub_schurs;
8937 Mat S_j;
8938 PetscInt *used_xadj,*used_adjncy;
8939 PetscBool free_used_adj;
8940 PetscErrorCode ierr;
8941
8942 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8942; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8943 ierr = PetscLogEventBegin(PC_BDDC_Schurs[pcbddc->current_level],pc,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_Schurs[pcbddc->current_level]].active) ? (*PetscLogPLB
)((PC_BDDC_Schurs[pcbddc->current_level]),0,(PetscObject)(
pc),(PetscObject)(0),(PetscObject)(0),(PetscObject)(0)) : 0 )
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8943,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8944 /* decide the adjacency to be used for determining internal problems for local schur on subsets */
8945 free_used_adj = PETSC_FALSE;
8946 if (pcbddc->sub_schurs_layers == -1) {
8947 used_xadj = NULL((void*)0);
8948 used_adjncy = NULL((void*)0);
8949 } else {
8950 if (pcbddc->sub_schurs_use_useradj && pcbddc->mat_graph->xadj) {
8951 used_xadj = pcbddc->mat_graph->xadj;
8952 used_adjncy = pcbddc->mat_graph->adjncy;
8953 } else if (pcbddc->computed_rowadj) {
8954 used_xadj = pcbddc->mat_graph->xadj;
8955 used_adjncy = pcbddc->mat_graph->adjncy;
8956 } else {
8957 PetscBool flg_row=PETSC_FALSE;
8958 const PetscInt *xadj,*adjncy;
8959 PetscInt nvtxs;
8960
8961 ierr = MatGetRowIJ(pcbddc->local_mat,0,PETSC_TRUE,PETSC_FALSE,&nvtxs,&xadj,&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8961,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8962 if (flg_row) {
8963 ierr = PetscMalloc2(nvtxs+1,&used_xadj,xadj[nvtxs],&used_adjncy)PetscMallocA(2,PETSC_FALSE,8963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(nvtxs+1)*sizeof(**(&used_xadj)),(&used_xadj
),(size_t)(xadj[nvtxs])*sizeof(**(&used_adjncy)),(&used_adjncy
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8963,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8964 ierr = PetscMemcpy(used_xadj,xadj,(nvtxs+1)*sizeof(*xadj));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8964,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8965 ierr = PetscMemcpy(used_adjncy,adjncy,(xadj[nvtxs])*sizeof(*adjncy));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8965,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8966 free_used_adj = PETSC_TRUE;
8967 } else {
8968 pcbddc->sub_schurs_layers = -1;
8969 used_xadj = NULL((void*)0);
8970 used_adjncy = NULL((void*)0);
8971 }
8972 ierr = MatRestoreRowIJ(pcbddc->local_mat,0,PETSC_TRUE,PETSC_FALSE,&nvtxs,&xadj,&adjncy,&flg_row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8972,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8973 }
8974 }
8975
8976 /* setup sub_schurs data */
8977 ierr = MatCreateSchurComplement(pcis->A_II,pcis->pA_II,pcis->A_IB,pcis->A_BI,pcis->A_BB,&S_j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8977,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8978 if (!sub_schurs->schur_explicit) {
8979 /* pcbddc->ksp_D up to date only if not using MatFactor with Schur complement support */
8980 ierr = MatSchurComplementSetKSP(S_j,pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8980,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8981 ierr = PCBDDCSubSchursSetUp(sub_schurs,NULL((void*)0),S_j,PETSC_FALSE,used_xadj,used_adjncy,pcbddc->sub_schurs_layers,NULL((void*)0),pcbddc->adaptive_selection,PETSC_FALSE,PETSC_FALSE,0,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8981,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8982 } else {
8983 Mat change = NULL((void*)0);
8984 Vec scaling = NULL((void*)0);
8985 IS change_primal = NULL((void*)0), iP;
8986 PetscInt benign_n;
8987 PetscBool reuse_solvers = (PetscBool)!pcbddc->use_change_of_basis;
8988 PetscBool isseqaij,need_change = PETSC_FALSE;
8989 PetscBool discrete_harmonic = PETSC_FALSE;
8990
8991 if (!pcbddc->use_vertices && reuse_solvers) {
8992 PetscInt n_vertices;
8993
8994 ierr = ISGetLocalSize(sub_schurs->is_vertices,&n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8994,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8995 reuse_solvers = (PetscBool)!n_vertices;
8996 }
8997 ierr = PetscObjectTypeCompare((PetscObject)pcbddc->local_mat,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8997,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8998 if (!isseqaij) {
8999 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
9000 if (matis->A == pcbddc->local_mat) {
9001 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9001,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9002 ierr = MatConvert(matis->A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9002,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9003 } else {
9004 ierr = MatConvert(pcbddc->local_mat,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9004,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9005 }
9006 }
9007 if (!pcbddc->benign_change_explicit) {
9008 benign_n = pcbddc->benign_n;
9009 } else {
9010 benign_n = 0;
9011 }
9012 /* sub_schurs->change is a local object; instead, PCBDDCConstraintsSetUp and the quantities used in the test below are logically collective on pc.
9013 We need a global reduction to avoid possible deadlocks.
9014 We assume that sub_schurs->change is created once, and then reused for different solves, unless the topography has been recomputed */
9015 if (pcbddc->adaptive_userdefined || (pcbddc->deluxe_zerorows && !pcbddc->use_change_of_basis)) {
9016 PetscBool have_loc_change = (PetscBool)(!!sub_schurs->change);
9017 ierr = MPIU_Allreduce(&have_loc_change,&need_change,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,9017,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)pc))),0) || MPI_Allreduce((&have_loc_change
),(&need_change),(1),(MPIU_BOOL),((MPI_Op)(0x58000007)),(
PetscObjectComm((PetscObject)pc)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9017,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9018 need_change = (PetscBool)(!need_change);
9019 }
9020 /* If the user defines additional constraints, we import them here.
9021 We need to compute the change of basis according to the quadrature weights attached to pmat via MatSetNearNullSpace, and this could not be done (at the moment) without some hacking */
9022 if (need_change) {
9023 PC_IS *pcisf;
9024 PC_BDDC *pcbddcf;
9025 PC pcf;
9026
9027 if (pcbddc->sub_schurs_rebuild) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cannot compute change of basis with a different graph")return PetscError(((MPI_Comm)0x44000001),9027,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot compute change of basis with a different graph"
)
;
9028 ierr = PCCreate(PetscObjectComm((PetscObject)pc),&pcf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9028,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9029 ierr = PCSetOperators(pcf,pc->mat,pc->pmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9029,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9030 ierr = PCSetType(pcf,PCBDDC"bddc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9030,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9031
9032 /* hacks */
9033 pcisf = (PC_IS*)pcf->data;
9034 pcisf->is_B_local = pcis->is_B_local;
9035 pcisf->vec1_N = pcis->vec1_N;
9036 pcisf->BtoNmap = pcis->BtoNmap;
9037 pcisf->n = pcis->n;
9038 pcisf->n_B = pcis->n_B;
9039 pcbddcf = (PC_BDDC*)pcf->data;
9040 ierr = PetscFree(pcbddcf->mat_graph)((*PetscTrFree)((void*)(pcbddcf->mat_graph),9040,__func__,
"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddcf->mat_graph) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9040,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9041 pcbddcf->mat_graph = pcbddc->mat_graph;
9042 pcbddcf->use_faces = PETSC_TRUE;
9043 pcbddcf->use_change_of_basis = PETSC_TRUE;
9044 pcbddcf->use_change_on_faces = PETSC_TRUE;
9045 pcbddcf->use_qr_single = PETSC_TRUE;
9046 pcbddcf->fake_change = PETSC_TRUE;
9047
9048 /* setup constraints so that we can get information on primal vertices and change of basis (in local numbering) */
9049 ierr = PCBDDCConstraintsSetUp(pcf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9049,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9050 sub_schurs->change_with_qr = pcbddcf->use_qr_single;
9051 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddcf->n_vertices,pcbddcf->local_primal_ref_node,PETSC_COPY_VALUES,&change_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9051,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9052 change = pcbddcf->ConstraintMatrix;
9053 pcbddcf->ConstraintMatrix = NULL((void*)0);
9054
9055 /* free unneeded memory allocated in PCBDDCConstraintsSetUp */
9056 ierr = PetscFree(pcbddcf->sub_schurs)((*PetscTrFree)((void*)(pcbddcf->sub_schurs),9056,__func__
,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddcf->sub_schurs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9056,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9057 ierr = MatNullSpaceDestroy(&pcbddcf->onearnullspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9057,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9058 ierr = PetscFree2(pcbddcf->local_primal_ref_node,pcbddcf->local_primal_ref_mult)PetscFreeA(2,9058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(pcbddcf->local_primal_ref_node),&(pcbddcf->local_primal_ref_mult
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9058,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9059 ierr = PetscFree(pcbddcf->primal_indices_local_idxs)((*PetscTrFree)((void*)(pcbddcf->primal_indices_local_idxs
),9059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddcf->primal_indices_local_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9059,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9060 ierr = PetscFree(pcbddcf->onearnullvecs_state)((*PetscTrFree)((void*)(pcbddcf->onearnullvecs_state),9060
,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddcf->onearnullvecs_state) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9060,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9061 ierr = PetscFree(pcf->data)((*PetscTrFree)((void*)(pcf->data),9061,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcf->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9061,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9062 pcf->ops->destroy = NULL((void*)0);
9063 pcf->ops->reset = NULL((void*)0);
9064 ierr = PCDestroy(&pcf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9064,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9065 }
9066 if (!pcbddc->use_deluxe_scaling) scaling = pcis->D;
9067
9068 ierr = PetscObjectQuery((PetscObject)pc,"__KSPFETIDP_iP",(PetscObject*)&iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9068,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9069 if (iP) {
9070 ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)iP),sub_schurs->prefix,"BDDC sub_schurs options","PC")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)iP),sub_schurs->prefix,"BDDC sub_schurs options"
,"PC");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),9070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9070,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9071 ierr = PetscOptionsBool("-sub_schurs_discrete_harmonic",NULL,NULL,discrete_harmonic,&discrete_harmonic,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-sub_schurs_discrete_harmonic"
,((void*)0),((void*)0),discrete_harmonic,&discrete_harmonic
,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9071,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9072 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9072,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9073 }
9074 if (discrete_harmonic) {
9075 Mat A;
9076 ierr = MatDuplicate(pcbddc->local_mat,MAT_COPY_VALUES,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9076,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9077 ierr = MatZeroRowsColumnsIS(A,iP,1.0,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9077,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9078 ierr = PetscObjectCompose((PetscObject)A,"__KSPFETIDP_iP",(PetscObject)iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9078,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9079 ierr = PCBDDCSubSchursSetUp(sub_schurs,A,S_j,pcbddc->sub_schurs_exact_schur,used_xadj,used_adjncy,pcbddc->sub_schurs_layers,scaling,pcbddc->adaptive_selection,reuse_solvers,pcbddc->benign_saddle_point,benign_n,pcbddc->benign_p0_lidx,pcbddc->benign_zerodiag_subs,change,change_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9079,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9080 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9080,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9081 } else {
9082 ierr = PCBDDCSubSchursSetUp(sub_schurs,pcbddc->local_mat,S_j,pcbddc->sub_schurs_exact_schur,used_xadj,used_adjncy,pcbddc->sub_schurs_layers,scaling,pcbddc->adaptive_selection,reuse_solvers,pcbddc->benign_saddle_point,benign_n,pcbddc->benign_p0_lidx,pcbddc->benign_zerodiag_subs,change,change_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9082,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9083 }
9084 ierr = MatDestroy(&change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9084,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9085 ierr = ISDestroy(&change_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9085,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9086 }
9087 ierr = MatDestroy(&S_j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9087,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9088
9089 /* free adjacency */
9090 if (free_used_adj) {
9091 ierr = PetscFree2(used_xadj,used_adjncy)PetscFreeA(2,9091,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(used_xadj),&(used_adjncy))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9091,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9092 }
9093 ierr = PetscLogEventEnd(PC_BDDC_Schurs[pcbddc->current_level],pc,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[PC_BDDC_Schurs[pcbddc->current_level]].active) ? (*PetscLogPLE
)((PC_BDDC_Schurs[pcbddc->current_level]),0,(PetscObject)(
pc),(PetscObject)(0),(PetscObject)(0),(PetscObject)(0)) : 0 )
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9093,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9094 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9095}
9096
9097PetscErrorCode PCBDDCInitSubSchurs(PC pc)
9098{
9099 PC_IS *pcis=(PC_IS*)pc->data;
9100 PC_BDDC *pcbddc=(PC_BDDC*)pc->data;
9101 PCBDDCGraph graph;
9102 PetscErrorCode ierr;
9103
9104 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 9104; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
9105 /* attach interface graph for determining subsets */
9106 if (pcbddc->sub_schurs_rebuild) { /* in case rebuild has been requested, it uses a graph generated only by the neighbouring information */
9107 IS verticesIS,verticescomm;
9108 PetscInt vsize,*idxs;
9109
9110 ierr = PCBDDCGraphGetCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&verticesIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9110,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9111 ierr = ISGetSize(verticesIS,&vsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9111,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9112 ierr = ISGetIndices(verticesIS,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9112,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9113 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),vsize,idxs,PETSC_COPY_VALUES,&verticescomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9113,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9114 ierr = ISRestoreIndices(verticesIS,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9114,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9115 ierr = PCBDDCGraphRestoreCandidatesIS(pcbddc->mat_graph,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&verticesIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9115,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9116 ierr = PCBDDCGraphCreate(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9116,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9117 ierr = PCBDDCGraphInit(graph,pcbddc->mat_graph->l2gmap,pcbddc->mat_graph->nvtxs_global,pcbddc->graphmaxcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9117,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9118 ierr = PCBDDCGraphSetUp(graph,pcbddc->mat_graph->custom_minimal_size,NULL((void*)0),pcbddc->DirichletBoundariesLocal,0,NULL((void*)0),verticescomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9118,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9119 ierr = ISDestroy(&verticescomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9119,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9120 ierr = PCBDDCGraphComputeConnectedComponents(graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9120,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9121 } else {
9122 graph = pcbddc->mat_graph;
9123 }
9124 /* print some info */
9125 if (pcbddc->dbg_flag && !pcbddc->sub_schurs_rebuild) {
9126 IS vertices;
9127 PetscInt nv,nedges,nfaces;
9128 ierr = PCBDDCGraphASCIIView(graph,pcbddc->dbg_flag,pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9128,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9129 ierr = PCBDDCGraphGetCandidatesIS(graph,&nfaces,NULL((void*)0),&nedges,NULL((void*)0),&vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9129,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9130 ierr = ISGetSize(vertices,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9130,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9131 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9131,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9132 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"--------------------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9132,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9133 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d got %02d local candidate vertices (%D)\n",PetscGlobalRank,(int)nv,pcbddc->use_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9133,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9134 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d got %02d local candidate edges (%D)\n",PetscGlobalRank,(int)nedges,pcbddc->use_edges);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9134,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9135 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d got %02d local candidate faces (%D)\n",PetscGlobalRank,(int)nfaces,pcbddc->use_faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9135,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9136 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9136,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9137 ierr = PetscViewerASCIIPopSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9137,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9138 ierr = PCBDDCGraphRestoreCandidatesIS(graph,&nfaces,NULL((void*)0),&nedges,NULL((void*)0),&vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9138,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9139 }
9140
9141 /* sub_schurs init */
9142 if (!pcbddc->sub_schurs) {
9143 ierr = PCBDDCSubSchursCreate(&pcbddc->sub_schurs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9143,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9144 }
9145 ierr = PCBDDCSubSchursInit(pcbddc->sub_schurs,((PetscObject)pc)->prefix,pcis->is_I_local,pcis->is_B_local,graph,pcis->BtoNmap,pcbddc->sub_schurs_rebuild);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9145,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9146
9147 /* free graph struct */
9148 if (pcbddc->sub_schurs_rebuild) {
9149 ierr = PCBDDCGraphDestroy(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9149,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9150 }
9151 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9152}
9153
9154PetscErrorCode PCBDDCCheckOperator(PC pc)
9155{
9156 PC_IS *pcis=(PC_IS*)pc->data;
9157 PC_BDDC *pcbddc=(PC_BDDC*)pc->data;
9158 PetscErrorCode ierr;
9159
9160 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 9160; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
9161 if (pcbddc->n_vertices == pcbddc->local_primal_size) {
9162 IS zerodiag = NULL((void*)0);
9163 Mat S_j,B0_B=NULL((void*)0);
9164 Vec dummy_vec=NULL((void*)0),vec_check_B,vec_scale_P;
9165 PetscScalar *p0_check,*array,*array2;
9166 PetscReal norm;
9167 PetscInt i;
9168
9169 /* B0 and B0_B */
9170 if (zerodiag) {
9171 IS dummy;
9172
9173 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),pcbddc->benign_n,0,1,&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9173,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9174 ierr = MatCreateSubMatrix(pcbddc->benign_B0,dummy,pcis->is_B_local,MAT_INITIAL_MATRIX,&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9174,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9175 ierr = MatCreateVecs(B0_B,NULL((void*)0),&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9175,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9176 ierr = ISDestroy(&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9176,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9177 }
9178 /* I need a primal vector to scale primal nodes since BDDC sums contibutions */
9179 ierr = VecDuplicate(pcbddc->vec1_P,&vec_scale_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9179,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9180 ierr = VecSet(pcbddc->vec1_P,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9180,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9181 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,pcbddc->vec1_P,pcbddc->coarse_vec,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9181,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9182 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,pcbddc->vec1_P,pcbddc->coarse_vec,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9182,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9183 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,pcbddc->coarse_vec,vec_scale_P,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9183,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9184 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,pcbddc->coarse_vec,vec_scale_P,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9184,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9185 ierr = VecReciprocal(vec_scale_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9185,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9186 /* S_j */
9187 ierr = MatCreateSchurComplement(pcis->A_II,pcis->pA_II,pcis->A_IB,pcis->A_BI,pcis->A_BB,&S_j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9187,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9188 ierr = MatSchurComplementSetKSP(S_j,pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9188,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9189
9190 /* mimic vector in \widetilde{W}_\Gamma */
9191 ierr = VecSetRandom(pcis->vec1_N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9191,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9192 /* continuous in primal space */
9193 ierr = VecSetRandom(pcbddc->coarse_vec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9193,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9194 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,pcbddc->coarse_vec,pcbddc->vec1_P,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9194,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9195 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,pcbddc->coarse_vec,pcbddc->vec1_P,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9195,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9196 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9196,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9197 ierr = PetscCalloc1(pcbddc->benign_n,&p0_check)PetscMallocA(1,PETSC_TRUE,9197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(pcbddc->benign_n)*sizeof(**(&p0_check)),(&
p0_check))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9197,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9198 for (i=0;i<pcbddc->benign_n;i++) p0_check[i] = array[pcbddc->local_primal_size-pcbddc->benign_n+i];
9199 ierr = VecSetValues(pcis->vec1_N,pcbddc->local_primal_size,pcbddc->local_primal_ref_node,array,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9199,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9200 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9200,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9201 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9201,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9202 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9202,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9203 ierr = VecScatterBegin(pcis->N_to_B,pcis->vec1_N,pcis->vec2_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9203,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9204 ierr = VecScatterEnd(pcis->N_to_B,pcis->vec1_N,pcis->vec2_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9204,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9205 ierr = VecDuplicate(pcis->vec2_B,&vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9206 ierr = VecCopy(pcis->vec2_B,vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9206,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9207
9208 /* assemble rhs for coarse problem */
9209 /* widetilde{S}_\Gamma w_\Gamma + \widetilde{B0}^T_B p0 */
9210 /* local with Schur */
9211 ierr = MatMult(S_j,pcis->vec2_B,pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9211,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9212 if (zerodiag) {
9213 ierr = VecGetArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9214 for (i=0;i<pcbddc->benign_n;i++) array[i] = p0_check[i];
9215 ierr = VecRestoreArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9215,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9216 ierr = MatMultTransposeAdd(B0_B,dummy_vec,pcis->vec1_B,pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9216,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9217 }
9218 /* sum on primal nodes the local contributions */
9219 ierr = VecScatterBegin(pcis->N_to_B,pcis->vec1_B,pcis->vec1_N,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9219,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9220 ierr = VecScatterEnd(pcis->N_to_B,pcis->vec1_B,pcis->vec1_N,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9220,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9221 ierr = VecGetArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9221,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9222 ierr = VecGetArray(pcbddc->vec1_P,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9222,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9223 for (i=0;i<pcbddc->local_primal_size;i++) array2[i] = array[pcbddc->local_primal_ref_node[i]];
9224 ierr = VecRestoreArray(pcbddc->vec1_P,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9224,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9225 ierr = VecRestoreArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9225,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9226 ierr = VecSet(pcbddc->coarse_vec,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9226,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9227 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,pcbddc->vec1_P,pcbddc->coarse_vec,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9227,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9228 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,pcbddc->vec1_P,pcbddc->coarse_vec,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9228,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9229 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,pcbddc->coarse_vec,pcbddc->vec1_P,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9229,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9230 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,pcbddc->coarse_vec,pcbddc->vec1_P,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9230,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9231 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9231,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9232 /* scale primal nodes (BDDC sums contibutions) */
9233 ierr = VecPointwiseMult(pcbddc->vec1_P,vec_scale_P,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9233,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9234 ierr = VecSetValues(pcis->vec1_N,pcbddc->local_primal_size,pcbddc->local_primal_ref_node,array,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9234,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9235 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9235,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9236 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9236,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9237 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9237,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9238 ierr = VecScatterBegin(pcis->N_to_B,pcis->vec1_N,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9238,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9239 ierr = VecScatterEnd(pcis->N_to_B,pcis->vec1_N,pcis->vec1_B,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9239,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9240 /* global: \widetilde{B0}_B w_\Gamma */
9241 if (zerodiag) {
9242 ierr = MatMult(B0_B,pcis->vec2_B,dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9242,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9243 ierr = VecGetArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9243,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9244 for (i=0;i<pcbddc->benign_n;i++) pcbddc->benign_p0[i] = array[i];
9245 ierr = VecRestoreArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9245,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9246 }
9247 /* BDDC */
9248 ierr = VecSet(pcis->vec1_D,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9248,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9249 ierr = PCBDDCApplyInterfacePreconditioner(pc,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9249,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9250
9251 ierr = VecCopy(pcis->vec1_B,pcis->vec2_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9251,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9252 ierr = VecAXPY(pcis->vec1_B,-1.0,vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9252,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9253 ierr = VecNorm(pcis->vec1_B,NORM_INFINITY,&norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9253,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9254 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"[%d] BDDC local error is %1.4e\n",PetscGlobalRank,norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9254,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9255 for (i=0;i<pcbddc->benign_n;i++) {
9256 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"[%d] BDDC p0[%D] error is %1.4e\n",PetscGlobalRank,i,PetscAbsScalar(pcbddc->benign_p0[i]-p0_check[i]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9256,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9257 }
9258 ierr = PetscFree(p0_check)((*PetscTrFree)((void*)(p0_check),9258,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((p0_check) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9258,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9259 ierr = VecDestroy(&vec_scale_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9259,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9260 ierr = VecDestroy(&vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9261 ierr = VecDestroy(&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9261,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9262 ierr = MatDestroy(&S_j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9262,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9263 ierr = MatDestroy(&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9263,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9264 }
9265 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9266}
9267
9268#include <../src/mat/impls/aij/mpi/mpiaij.h>
9269PetscErrorCode MatMPIAIJRestrict(Mat A, MPI_Comm ccomm, Mat *B)
9270{
9271 Mat At;
9272 IS rows;
9273 PetscInt rst,ren;
9274 PetscErrorCode ierr;
9275 PetscLayout rmap;
9276
9277 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 9277; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
9278 rst = ren = 0;
9279 if (ccomm != MPI_COMM_NULL((MPI_Comm)0x04000000)) {
9280 ierr = PetscLayoutCreate(ccomm,&rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9280,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9281 ierr = PetscLayoutSetSize(rmap,A->rmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9281,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9282 ierr = PetscLayoutSetBlockSize(rmap,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9282,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9283 ierr = PetscLayoutSetUp(rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9283,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9284 ierr = PetscLayoutGetRange(rmap,&rst,&ren);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9284,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9285 }
9286 ierr = ISCreateStride(PetscObjectComm((PetscObject)A),ren-rst,rst,1,&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9286,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9287 ierr = MatCreateSubMatrix(A,rows,NULL((void*)0),MAT_INITIAL_MATRIX,&At);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9287,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9288 ierr = ISDestroy(&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9288,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9289
9290 if (ccomm != MPI_COMM_NULL((MPI_Comm)0x04000000)) {
9291 Mat_MPIAIJ *a,*b;
9292 IS from,to;
9293 Vec gvec;
9294 PetscInt lsize;
9295
9296 ierr = MatCreate(ccomm,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9296,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9297 ierr = MatSetSizes(*B,ren-rst,PETSC_DECIDE-1,PETSC_DECIDE-1,At->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9297,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9298 ierr = MatSetType(*B,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9298,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9299 ierr = PetscLayoutDestroy(&((*B)->rmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9299,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9300 ierr = PetscLayoutSetUp((*B)->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9300,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9301 a = (Mat_MPIAIJ*)At->data;
9302 b = (Mat_MPIAIJ*)(*B)->data;
9303 ierr = MPI_Comm_size(ccomm,&b->size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9303,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9304 ierr = MPI_Comm_rank(ccomm,&b->rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9304,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9305 ierr = PetscObjectReference((PetscObject)a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9305,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9306 ierr = PetscObjectReference((PetscObject)a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9306,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9307 b->A = a->A;
9308 b->B = a->B;
9309
9310 b->donotstash = a->donotstash;
9311 b->roworiented = a->roworiented;
9312 b->rowindices = 0;
9313 b->rowvalues = 0;
9314 b->getrowactive = PETSC_FALSE;
9315
9316 (*B)->rmap = rmap;
9317 (*B)->factortype = A->factortype;
9318 (*B)->assembled = PETSC_TRUE;
9319 (*B)->insertmode = NOT_SET_VALUES;
9320 (*B)->preallocated = PETSC_TRUE;
9321
9322 if (a->colmap) {
9323#if defined(PETSC_USE_CTABLE1)
9324 ierr = PetscTableCreateCopy(a->colmap,&b->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9324,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9325#else
9326 ierr = PetscMalloc1(At->cmap->N,&b->colmap)PetscMallocA(1,PETSC_FALSE,9326,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(At->cmap->N)*sizeof(**(&b->colmap)),(&
b->colmap))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9326,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9327 ierr = PetscLogObjectMemory((PetscObject)*B,At->cmap->N*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9327,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9328 ierr = PetscMemcpy(b->colmap,a->colmap,At->cmap->N*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9328,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9329#endif
9330 } else b->colmap = 0;
9331 if (a->garray) {
9332 PetscInt len;
9333 len = a->B->cmap->n;
9334 ierr = PetscMalloc1(len+1,&b->garray)PetscMallocA(1,PETSC_FALSE,9334,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,(size_t)(len+1)*sizeof(**(&b->garray)),(&b->garray
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9334,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9335 ierr = PetscLogObjectMemory((PetscObject)(*B),len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9335,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9336 if (len) { ierr = PetscMemcpy(b->garray,a->garray,len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9336,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
9337 } else b->garray = 0;
9338
9339 ierr = PetscObjectReference((PetscObject)a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9339,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9340 b->lvec = a->lvec;
9341 ierr = PetscLogObjectParent((PetscObject)*B,(PetscObject)b->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9341,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9342
9343 /* cannot use VecScatterCopy */
9344 ierr = VecGetLocalSize(b->lvec,&lsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9344,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9345 ierr = ISCreateGeneral(ccomm,lsize,b->garray,PETSC_USE_POINTER,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9346 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),lsize,0,1,&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9346,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9347 ierr = MatCreateVecs(*B,&gvec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9347,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9348 ierr = VecScatterCreate(gvec,from,b->lvec,to,&b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9348,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9349 ierr = PetscLogObjectParent((PetscObject)*B,(PetscObject)b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9349,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9350 ierr = ISDestroy(&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9351 ierr = ISDestroy(&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9352 ierr = VecDestroy(&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9352,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9353 }
9354 ierr = MatDestroy(&At);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9354,__func__,"/sandbox/petsc/petsc.next-tmp/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9355 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9356}