Bug Summary

File:ksp/pc/impls/bddc/bddcprivate.c
Warning:line 2717, 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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),53,__func__,"/sandbox/petsc/petsc.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
68 ierr = PetscArraycpy(data,U+nr*i,(nr-i)*nr)((sizeof(*(data)) != sizeof(*(U+nr*i))) || PetscMemcpy(data,U
+nr*i,((nr-i)*nr)*sizeof(*(data))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),68,__func__,"/sandbox/petsc/petsc.master/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.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
72 ierr = PetscArraycpy(data,U,i*nr)((sizeof(*(data)) != sizeof(*(U))) || PetscMemcpy(data,U,(i*nr
)*sizeof(*(data))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),72,__func__,"/sandbox/petsc/petsc.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
118
119 if (corners) {
120 Mat GEc;
121 const PetscScalar *vals;
122 PetscScalar v;
123
124 ierr = MatCreateSubMatrix(lG,edge,corners,MAT_INITIAL_MATRIX,&GEc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),124,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
125 ierr = MatTransposeMatMult(GEc,*GKins,MAT_INITIAL_MATRIX,1.0,&GEd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),125,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
126 ierr = MatDenseGetArrayRead(GEd,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),126,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
127 /* v = PetscAbsScalar(vals[0]) */;
128 v = 1.;
129 cvals[0] = vals[0]/v;
130 cvals[1] = vals[1]/v;
131 ierr = MatDenseRestoreArrayRead(GEd,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),131,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
132 ierr = MatScale(*GKins,1./v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),132,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
133#if defined(PRINT_GDET)
134 {
135 PetscViewer viewer;
136 char filename[256];
137 sprintf(filename,"Gdet_l%d_r%d_cc%d.m",lev,PetscGlobalRank,inc++);
138 ierr = PetscViewerASCIIOpen(PETSC_COMM_SELF((MPI_Comm)0x44000001),filename,&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),138,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
139 ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),139,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
140 ierr = PetscObjectSetName((PetscObject)GEc,"GEc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),140,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
141 ierr = MatView(GEc,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),141,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
142 ierr = PetscObjectSetName((PetscObject)(*GKins),"GK");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),142,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
143 ierr = MatView(*GKins,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),143,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
144 ierr = PetscObjectSetName((PetscObject)GEd,"Gproj");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),144,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
145 ierr = MatView(GEd,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),145,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
146 ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),146,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
147 }
148#endif
149 ierr = MatDestroy(&GEd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),149,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
150 ierr = MatDestroy(&GEc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),150,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
151 }
152
153 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
154}
155
156PetscErrorCode PCBDDCNedelecSupport(PC pc)
157{
158 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
159 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
160 Mat G,T,conn,lG,lGt,lGis,lGall,lGe,lGinit;
161 Vec tvec;
162 PetscSF sfv;
163 ISLocalToGlobalMapping el2g,vl2g,fl2g,al2g;
164 MPI_Comm comm;
165 IS lned,primals,allprimals,nedfieldlocal;
166 IS *eedges,*extrows,*extcols,*alleedges;
167 PetscBT btv,bte,btvc,btb,btbd,btvcand,btvi,btee,bter;
168 PetscScalar *vals,*work;
169 PetscReal *rwork;
170 const PetscInt *idxs,*ii,*jj,*iit,*jjt;
171 PetscInt ne,nv,Lv,order,n,field;
172 PetscInt n_neigh,*neigh,*n_shared,**shared;
173 PetscInt i,j,extmem,cum,maxsize,nee;
174 PetscInt *extrow,*extrowcum,*marks,*vmarks,*gidxs;
175 PetscInt *sfvleaves,*sfvroots;
176 PetscInt *corners,*cedges;
177 PetscInt *ecount,**eneighs,*vcount,**vneighs;
178#if defined(PETSC_USE_DEBUG1)
179 PetscInt *emarks;
180#endif
181 PetscBool print,eerr,done,lrc[2],conforming,global,singular,setprimal;
182 PetscErrorCode ierr;
183
184 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 184; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
185 /* If the discrete gradient is defined for a subset of dofs and global is true,
186 it assumes G is given in global ordering for all the dofs.
187 Otherwise, the ordering is global for the Nedelec field */
188 order = pcbddc->nedorder;
189 conforming = pcbddc->conforming;
190 field = pcbddc->nedfield;
191 global = pcbddc->nedglobal;
192 setprimal = PETSC_FALSE;
193 print = PETSC_FALSE;
194 singular = PETSC_FALSE;
195
196 /* Command line customization */
197 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),197,__func__,"/sandbox/petsc/petsc.master/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),197,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
198 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),198,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
199 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),199,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
200 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),(-2147483647 - 1),2147483647)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),200,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
201 /* print debug info TODO: to be removed */
202 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),202,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
203 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),203,__func__,"/sandbox/petsc/petsc.master/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),203,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
204
205 /* Return if there are no edges in the decomposition and the problem is not singular */
206 ierr = MatGetLocalToGlobalMapping(pc->pmat,&al2g,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),206,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
207 ierr = ISLocalToGlobalMappingGetSize(al2g,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),207,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
208 ierr = PetscObjectGetComm((PetscObject)pc,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
209 if (!singular) {
210 ierr = VecGetArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),210,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
211 lrc[0] = PETSC_FALSE;
212 for (i=0;i<n;i++) {
213 if (PetscRealPart(vals[i])(vals[i]) > 2.) {
214 lrc[0] = PETSC_TRUE;
215 break;
216 }
217 }
218 ierr = VecRestoreArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),218,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
219 ierr = MPIU_Allreduce(&lrc[0],&lrc[1],1,MPIU_BOOL,MPI_LOR,comm)(PetscAllreduceBarrierCheck(comm,1,219,__func__,"/sandbox/petsc/petsc.master/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),219,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
220 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)
;
221 }
222
223 /* Get Nedelec field */
224 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,224,__func__,"/sandbox/petsc/petsc.master/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)
;
225 if (pcbddc->n_ISForDofsLocal && field >= 0) {
226 ierr = PetscObjectReference((PetscObject)pcbddc->ISForDofsLocal[field]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),226,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
227 nedfieldlocal = pcbddc->ISForDofsLocal[field];
228 ierr = ISGetLocalSize(nedfieldlocal,&ne);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),228,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
229 } else if (!pcbddc->n_ISForDofsLocal && field != PETSC_DECIDE-1) {
230 ne = n;
231 nedfieldlocal = NULL((void*)0);
232 global = PETSC_TRUE;
233 } else if (field == PETSC_DECIDE-1) {
234 PetscInt rst,ren,*idx;
235
236 ierr = PetscArrayzero(matis->sf_leafdata,n)PetscMemzero(matis->sf_leafdata,(n)*sizeof(*(matis->sf_leafdata
)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),236,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
237 ierr = PetscArrayzero(matis->sf_rootdata,pc->pmat->rmap->n)PetscMemzero(matis->sf_rootdata,(pc->pmat->rmap->
n)*sizeof(*(matis->sf_rootdata)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 ierr = MatGetOwnershipRange(pcbddc->discretegradient,&rst,&ren);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),238,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
239 for (i=rst;i<ren;i++) {
240 PetscInt nc;
241
242 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),242,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
243 if (nc > 1) matis->sf_rootdata[i-rst] = 1;
244 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),244,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
245 }
246 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),246,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
247 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),247,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
248 ierr = PetscMalloc1(n,&idx)PetscMallocA(1,PETSC_FALSE,248,__func__,"/sandbox/petsc/petsc.master/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),248,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
249 for (i=0,ne=0;i<n;i++) if (matis->sf_leafdata[i]) idx[ne++] = i;
250 ierr = ISCreateGeneral(comm,ne,idx,PETSC_OWN_POINTER,&nedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
251 } else {
252 SETERRQ(comm,PETSC_ERR_USER,"When multiple fields are present, the Nedelec field has to be specified")return PetscError(comm,252,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"When multiple fields are present, the Nedelec field has to be specified"
)
;
253 }
254
255 /* Sanity checks */
256 if (!order && !conforming) SETERRQ(comm,PETSC_ERR_SUP,"Variable order and non-conforming spaces are not supported at the same time")return PetscError(comm,256,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Variable order and non-conforming spaces are not supported at the same time"
)
;
257 if (pcbddc->user_ChangeOfBasisMatrix) SETERRQ(comm,PETSC_ERR_SUP,"Cannot generate Nedelec support with user defined change of basis")return PetscError(comm,257,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot generate Nedelec support with user defined change of basis"
)
;
258 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),258,__func__,"/sandbox/petsc/petsc.master/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)
;
259
260 /* Just set primal dofs and return */
261 if (setprimal) {
262 IS enedfieldlocal;
263 PetscInt *eidxs;
264
265 ierr = PetscMalloc1(ne,&eidxs)PetscMallocA(1,PETSC_FALSE,265,__func__,"/sandbox/petsc/petsc.master/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),265,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
266 ierr = VecGetArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),266,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
267 if (nedfieldlocal) {
268 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),268,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
269 for (i=0,cum=0;i<ne;i++) {
270 if (PetscRealPart(vals[idxs[i]])(vals[idxs[i]]) > 2.) {
271 eidxs[cum++] = idxs[i];
272 }
273 }
274 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),274,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
275 } else {
276 for (i=0,cum=0;i<ne;i++) {
277 if (PetscRealPart(vals[i])(vals[i]) > 2.) {
278 eidxs[cum++] = i;
279 }
280 }
281 }
282 ierr = VecRestoreArrayRead(matis->counter,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),282,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
283 ierr = ISCreateGeneral(comm,cum,eidxs,PETSC_COPY_VALUES,&enedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),283,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
284 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,enedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),284,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
285 ierr = PetscFree(eidxs)((*PetscTrFree)((void*)(eidxs),285,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),285,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
286 ierr = ISDestroy(&nedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),286,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
287 ierr = ISDestroy(&enedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),287,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
288 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
289 }
290
291 /* Compute some l2g maps */
292 if (nedfieldlocal) {
293 IS is;
294
295 /* need to map from the local Nedelec field to local numbering */
296 ierr = ISLocalToGlobalMappingCreateIS(nedfieldlocal,&fl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
297 /* need to map from the local Nedelec field to global numbering for the whole dofs*/
298 ierr = ISLocalToGlobalMappingApplyIS(al2g,nedfieldlocal,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),298,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
299 ierr = ISLocalToGlobalMappingCreateIS(is,&al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),299,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
300 /* need to map from the local Nedelec field to global numbering (for Nedelec only) */
301 if (global) {
302 ierr = PetscObjectReference((PetscObject)al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),302,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
303 el2g = al2g;
304 } else {
305 IS gis;
306
307 ierr = ISRenumber(is,NULL((void*)0),NULL((void*)0),&gis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),307,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
308 ierr = ISLocalToGlobalMappingCreateIS(gis,&el2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),308,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
309 ierr = ISDestroy(&gis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
310 }
311 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),311,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
312 } else {
313 /* restore default */
314 pcbddc->nedfield = -1;
315 /* one ref for the destruction of al2g, one for el2g */
316 ierr = PetscObjectReference((PetscObject)al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),316,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
317 ierr = PetscObjectReference((PetscObject)al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),317,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
318 el2g = al2g;
319 fl2g = NULL((void*)0);
320 }
321
322 /* Start communication to drop connections for interior edges (for cc analysis only) */
323 ierr = PetscArrayzero(matis->sf_leafdata,n)PetscMemzero(matis->sf_leafdata,(n)*sizeof(*(matis->sf_leafdata
)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),323,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
324 ierr = PetscArrayzero(matis->sf_rootdata,pc->pmat->rmap->n)PetscMemzero(matis->sf_rootdata,(pc->pmat->rmap->
n)*sizeof(*(matis->sf_rootdata)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),324,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
325 if (nedfieldlocal) {
326 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),326,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
327 for (i=0;i<ne;i++) matis->sf_leafdata[idxs[i]] = 1;
328 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),328,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
329 } else {
330 for (i=0;i<ne;i++) matis->sf_leafdata[i] = 1;
331 }
332 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),332,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
333 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),333,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
334
335 if (!singular) { /* drop connections with interior edges to avoid unneeded communications and memory movements */
336 ierr = MatDuplicate(pcbddc->discretegradient,MAT_COPY_VALUES,&G);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),336,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
337 ierr = MatSetOption(G,MAT_KEEP_NONZERO_PATTERN,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),337,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
338 if (global) {
339 PetscInt rst;
340
341 ierr = MatGetOwnershipRange(G,&rst,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),341,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
342 for (i=0,cum=0;i<pc->pmat->rmap->n;i++) {
343 if (matis->sf_rootdata[i] < 2) {
344 matis->sf_rootdata[cum++] = i + rst;
345 }
346 }
347 ierr = MatSetOption(G,MAT_NO_OFF_PROC_ZERO_ROWS,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),347,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
348 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),348,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
349 } else {
350 PetscInt *tbz;
351
352 ierr = PetscMalloc1(ne,&tbz)PetscMallocA(1,PETSC_FALSE,352,__func__,"/sandbox/petsc/petsc.master/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),352,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
353 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),353,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
354 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),354,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
355 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),355,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
356 for (i=0,cum=0;i<ne;i++)
357 if (matis->sf_leafdata[idxs[i]] == 1)
358 tbz[cum++] = i;
359 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),359,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
360 ierr = ISLocalToGlobalMappingApply(el2g,cum,tbz,tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),360,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
361 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),361,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
362 ierr = PetscFree(tbz)((*PetscTrFree)((void*)(tbz),362,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tbz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),362,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
363 }
364 } else { /* we need the entire G to infer the nullspace */
365 ierr = PetscObjectReference((PetscObject)pcbddc->discretegradient);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),365,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
366 G = pcbddc->discretegradient;
367 }
368
369 /* Extract subdomain relevant rows of G */
370 ierr = ISLocalToGlobalMappingGetIndices(el2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),370,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
371 ierr = ISCreateGeneral(comm,ne,idxs,PETSC_USE_POINTER,&lned);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),371,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
372 ierr = MatCreateSubMatrix(G,lned,NULL((void*)0),MAT_INITIAL_MATRIX,&lGall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
373 ierr = ISLocalToGlobalMappingRestoreIndices(el2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),373,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
374 ierr = ISDestroy(&lned);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),374,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
375 ierr = MatConvert(lGall,MATIS"is",MAT_INITIAL_MATRIX,&lGis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),375,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
376 ierr = MatDestroy(&lGall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),376,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
377 ierr = MatISGetLocalMat(lGis,&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),377,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
378
379 /* SF for nodal dofs communications */
380 ierr = MatGetLocalSize(G,NULL((void*)0),&Lv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),380,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
381 ierr = MatGetLocalToGlobalMapping(lGis,NULL((void*)0),&vl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),381,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
382 ierr = PetscObjectReference((PetscObject)vl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),382,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
383 ierr = ISLocalToGlobalMappingGetSize(vl2g,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),383,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
384 ierr = PetscSFCreate(comm,&sfv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),384,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
385 ierr = ISLocalToGlobalMappingGetIndices(vl2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),385,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
386 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),386,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
387 ierr = ISLocalToGlobalMappingRestoreIndices(vl2g,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),387,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
388 i = singular ? 2 : 1;
389 ierr = PetscMalloc2(i*nv,&sfvleaves,i*Lv,&sfvroots)PetscMallocA(2,PETSC_FALSE,389,__func__,"/sandbox/petsc/petsc.master/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),389,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
390
391 /* Destroy temporary G created in MATIS format and modified G */
392 ierr = PetscObjectReference((PetscObject)lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),392,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
393 ierr = MatDestroy(&lGis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),393,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
394 ierr = MatDestroy(&G);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),394,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
395
396 if (print) {
397 ierr = PetscObjectSetName((PetscObject)lG,"initial_lG");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),397,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
398 ierr = MatView(lG,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),398,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
399 }
400
401 /* Save lG for values insertion in change of basis */
402 ierr = MatDuplicate(lG,MAT_COPY_VALUES,&lGinit);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),402,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
403
404 /* Analyze the edge-nodes connections (duplicate lG) */
405 ierr = MatDuplicate(lG,MAT_COPY_VALUES,&lGe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),405,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
406 ierr = MatSetOption(lGe,MAT_KEEP_NONZERO_PATTERN,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),406,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
407 ierr = PetscBTCreate(nv,&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),407,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
408 ierr = PetscBTCreate(ne,&bte);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),408,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
409 ierr = PetscBTCreate(ne,&btb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),409,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
410 ierr = PetscBTCreate(ne,&btbd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),410,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
411 ierr = PetscBTCreate(nv,&btvcand);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),411,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
412 /* need to import the boundary specification to ensure the
413 proper detection of coarse edges' endpoints */
414 if (pcbddc->DirichletBoundariesLocal) {
415 IS is;
416
417 if (fl2g) {
418 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_MASK,pcbddc->DirichletBoundariesLocal,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),418,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
419 } else {
420 is = pcbddc->DirichletBoundariesLocal;
421 }
422 ierr = ISGetLocalSize(is,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),422,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
423 ierr = ISGetIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),423,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
424 for (i=0;i<cum;i++) {
425 if (idxs[i] >= 0) {
426 ierr = PetscBTSet(btb,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),426,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
427 ierr = PetscBTSet(btbd,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),427,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
428 }
429 }
430 ierr = ISRestoreIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),430,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
431 if (fl2g) {
432 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),432,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
433 }
434 }
435 if (pcbddc->NeumannBoundariesLocal) {
436 IS is;
437
438 if (fl2g) {
439 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_MASK,pcbddc->NeumannBoundariesLocal,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),439,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
440 } else {
441 is = pcbddc->NeumannBoundariesLocal;
442 }
443 ierr = ISGetLocalSize(is,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),443,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
444 ierr = ISGetIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),444,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
445 for (i=0;i<cum;i++) {
446 if (idxs[i] >= 0) {
447 ierr = PetscBTSet(btb,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),447,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
448 }
449 }
450 ierr = ISRestoreIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
451 if (fl2g) {
452 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),452,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
453 }
454 }
455
456 /* Count neighs per dof */
457 ierr = ISLocalToGlobalMappingGetNodeInfo(el2g,NULL((void*)0),&ecount,&eneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),457,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
458 ierr = ISLocalToGlobalMappingGetNodeInfo(vl2g,NULL((void*)0),&vcount,&vneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),458,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
459
460 /* need to remove coarse faces' dofs and coarse edges' dirichlet dofs
461 for proper detection of coarse edges' endpoints */
462 ierr = PetscBTCreate(ne,&btee);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),462,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
463 for (i=0;i<ne;i++) {
464 if ((ecount[i] > 2 && !PetscBTLookup(btbd,i)) || (ecount[i] == 2 && PetscBTLookup(btb,i))) {
465 ierr = PetscBTSet(btee,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),465,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
466 }
467 }
468 ierr = PetscMalloc1(ne,&marks)PetscMallocA(1,PETSC_FALSE,468,__func__,"/sandbox/petsc/petsc.master/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),468,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
469 if (!conforming) {
470 ierr = MatTranspose(lGe,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),470,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
471 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),471,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
472 }
473 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),473,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
474 ierr = MatSeqAIJGetArray(lGe,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),474,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
475 cum = 0;
476 for (i=0;i<ne;i++) {
477 /* eliminate rows corresponding to edge dofs belonging to coarse faces */
478 if (!PetscBTLookup(btee,i)) {
479 marks[cum++] = i;
480 continue;
481 }
482 /* set badly connected edge dofs as primal */
483 if (!conforming) {
484 if (ii[i+1]-ii[i] != order + 1) { /* every row of G on the coarse edge should list order+1 nodal dofs */
485 marks[cum++] = i;
486 ierr = PetscBTSet(bte,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),486,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
487 for (j=ii[i];j<ii[i+1];j++) {
488 ierr = PetscBTSet(btv,jj[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),488,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
489 }
490 } else {
491 /* every edge dofs should be connected trough a certain number of nodal dofs
492 to other edge dofs belonging to coarse edges
493 - at most 2 endpoints
494 - order-1 interior nodal dofs
495 - no undefined nodal dofs (nconn < order)
496 */
497 PetscInt ends = 0,ints = 0, undef = 0;
498 for (j=ii[i];j<ii[i+1];j++) {
499 PetscInt v = jj[j],k;
500 PetscInt nconn = iit[v+1]-iit[v];
501 for (k=iit[v];k<iit[v+1];k++) if (!PetscBTLookup(btee,jjt[k])) nconn--;
502 if (nconn > order) ends++;
503 else if (nconn == order) ints++;
504 else undef++;
505 }
506 if (undef || ends > 2 || ints != order -1) {
507 marks[cum++] = i;
508 ierr = PetscBTSet(bte,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),508,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
509 for (j=ii[i];j<ii[i+1];j++) {
510 ierr = PetscBTSet(btv,jj[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),510,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
511 }
512 }
513 }
514 }
515 /* We assume the order on the element edge is ii[i+1]-ii[i]-1 */
516 if (!order && ii[i+1] != ii[i]) {
517 PetscScalar val = 1./(ii[i+1]-ii[i]-1);
518 for (j=ii[i];j<ii[i+1];j++) vals[j] = val;
519 }
520 }
521 ierr = PetscBTDestroy(&btee);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),521,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
522 ierr = MatSeqAIJRestoreArray(lGe,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),522,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
523 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),523,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
524 if (!conforming) {
525 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),525,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
526 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),526,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
527 }
528 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),528,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
529
530 /* identify splitpoints and corner candidates */
531 ierr = MatTranspose(lGe,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),531,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
532 if (print) {
533 ierr = PetscObjectSetName((PetscObject)lGe,"edgerestr_lG");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),533,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
534 ierr = MatView(lGe,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),534,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
535 ierr = PetscObjectSetName((PetscObject)lGt,"edgerestr_lGt");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),535,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
536 ierr = MatView(lGt,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),536,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
537 }
538 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),538,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
539 ierr = MatSeqAIJGetArray(lGt,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),539,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
540 for (i=0;i<nv;i++) {
541 PetscInt ord = order, test = ii[i+1]-ii[i], vc = vcount[i];
542 PetscBool sneighs = PETSC_TRUE, bdir = PETSC_FALSE;
543 if (!order) { /* variable order */
544 PetscReal vorder = 0.;
545
546 for (j=ii[i];j<ii[i+1];j++) vorder += PetscRealPart(vals[j])(vals[j]);
547 test = PetscFloorReal(vorder+10.*PETSC_SQRT_MACHINE_EPSILON)floor(vorder+10.*1.490116119384766e-08);
548 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),548,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected value for vorder: %g (%D)"
,vorder,test)
;
549 ord = 1;
550 }
551#if defined(PETSC_USE_DEBUG1)
552 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),552,__func__,"/sandbox/petsc/petsc.master/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)
;
553#endif
554 for (j=ii[i];j<ii[i+1] && sneighs;j++) {
555 if (PetscBTLookup(btbd,jj[j])) {
556 bdir = PETSC_TRUE;
557 break;
558 }
559 if (vc != ecount[jj[j]]) {
560 sneighs = PETSC_FALSE;
561 } else {
562 PetscInt k,*vn = vneighs[i], *en = eneighs[jj[j]];
563 for (k=0;k<vc;k++) {
564 if (vn[k] != en[k]) {
565 sneighs = PETSC_FALSE;
566 break;
567 }
568 }
569 }
570 }
571 if (!sneighs || test >= 3*ord || bdir) { /* splitpoints */
572 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"SPLITPOINT %D (%D %D %D)\n",i,!sneighs,test >= 3*ord,bdir);
573 ierr = PetscBTSet(btv,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),573,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
574 } else if (test == ord) {
575 if (order == 1 || (!order && ii[i+1]-ii[i] == 1)) {
576 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"ENDPOINT %D\n",i);
577 ierr = PetscBTSet(btv,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),577,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
578 } else {
579 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"CORNER CANDIDATE %D\n",i);
580 ierr = PetscBTSet(btvcand,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),580,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
581 }
582 }
583 }
584 ierr = ISLocalToGlobalMappingRestoreNodeInfo(el2g,NULL((void*)0),&ecount,&eneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),584,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
585 ierr = ISLocalToGlobalMappingRestoreNodeInfo(vl2g,NULL((void*)0),&vcount,&vneighs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),585,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
586 ierr = PetscBTDestroy(&btbd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),586,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
587
588 /* a candidate is valid if it is connected to another candidate via a non-primal edge dof */
589 if (order != 1) {
590 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"INSPECTING CANDIDATES\n");
591 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),591,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
592 for (i=0;i<nv;i++) {
593 if (PetscBTLookup(btvcand,i)) {
594 PetscBool found = PETSC_FALSE;
595 for (j=ii[i];j<ii[i+1] && !found;j++) {
596 PetscInt k,e = jj[j];
597 if (PetscBTLookup(bte,e)) continue;
598 for (k=iit[e];k<iit[e+1];k++) {
599 PetscInt v = jjt[k];
600 if (v != i && PetscBTLookup(btvcand,v)) {
601 found = PETSC_TRUE;
602 break;
603 }
604 }
605 }
606 if (!found) {
607 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," CANDIDATE %D CLEARED\n",i);
608 ierr = PetscBTClear(btvcand,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),608,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
609 } else {
610 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," CANDIDATE %D ACCEPTED\n",i);
611 }
612 }
613 }
614 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),614,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
615 }
616 ierr = MatSeqAIJRestoreArray(lGt,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),616,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
617 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),617,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
618 ierr = MatDestroy(&lGe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),618,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
619
620 /* Get the local G^T explicitly */
621 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),621,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
622 ierr = MatTranspose(lG,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),622,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
623 ierr = MatSetOption(lGt,MAT_KEEP_NONZERO_PATTERN,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),623,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
624
625 /* Mark interior nodal dofs */
626 ierr = ISLocalToGlobalMappingGetInfo(vl2g,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),626,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
627 ierr = PetscBTCreate(nv,&btvi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),627,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
628 for (i=1;i<n_neigh;i++) {
629 for (j=0;j<n_shared[i];j++) {
630 ierr = PetscBTSet(btvi,shared[i][j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),630,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
631 }
632 }
633 ierr = ISLocalToGlobalMappingRestoreInfo(vl2g,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),633,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
634
635 /* communicate corners and splitpoints */
636 ierr = PetscMalloc1(nv,&vmarks)PetscMallocA(1,PETSC_FALSE,636,__func__,"/sandbox/petsc/petsc.master/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),636,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
637 ierr = PetscArrayzero(sfvleaves,nv)PetscMemzero(sfvleaves,(nv)*sizeof(*(sfvleaves)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),637,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
638 ierr = PetscArrayzero(sfvroots,Lv)PetscMemzero(sfvroots,(Lv)*sizeof(*(sfvroots)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),638,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
639 for (i=0;i<nv;i++) if (PetscUnlikely(PetscBTLookup(btv,i))__builtin_expect(!!(PetscBTLookup(btv,i)),0)) sfvleaves[i] = 1;
640
641 if (print) {
642 IS tbz;
643
644 cum = 0;
645 for (i=0;i<nv;i++)
646 if (sfvleaves[i])
647 vmarks[cum++] = i;
648
649 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),649,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
650 ierr = PetscObjectSetName((PetscObject)tbz,"corners_to_be_zeroed_local");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),650,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
651 ierr = ISView(tbz,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),651,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
652 ierr = ISDestroy(&tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),652,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
653 }
654
655 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),655,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
656 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),656,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
657 ierr = PetscSFBcastBegin(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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
658 ierr = PetscSFBcastEnd(sfv,MPIU_INT((MPI_Datatype)0x4c000405),sfvroots,sfvleaves);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),658,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
659
660 /* Zero rows of lGt corresponding to identified corners
661 and interior nodal dofs */
662 cum = 0;
663 for (i=0;i<nv;i++) {
664 if (sfvleaves[i]) {
665 vmarks[cum++] = i;
666 ierr = PetscBTSet(btv,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),666,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
667 }
668 if (!PetscBTLookup(btvi,i)) vmarks[cum++] = i;
669 }
670 ierr = PetscBTDestroy(&btvi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),670,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
671 if (print) {
672 IS tbz;
673
674 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),674,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
675 ierr = PetscObjectSetName((PetscObject)tbz,"corners_to_be_zeroed_with_interior");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),675,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
676 ierr = ISView(tbz,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),676,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
677 ierr = ISDestroy(&tbz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),677,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
678 }
679 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),679,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
680 ierr = PetscFree(vmarks)((*PetscTrFree)((void*)(vmarks),680,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vmarks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),680,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
681 ierr = PetscSFDestroy(&sfv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),681,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
682 ierr = PetscFree2(sfvleaves,sfvroots)PetscFreeA(2,682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(sfvleaves),&(sfvroots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
683
684 /* Recompute G */
685 ierr = MatDestroy(&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),685,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
686 ierr = MatTranspose(lGt,MAT_INITIAL_MATRIX,&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),686,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
687 if (print) {
688 ierr = PetscObjectSetName((PetscObject)lG,"used_lG");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),688,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
689 ierr = MatView(lG,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),689,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
690 ierr = PetscObjectSetName((PetscObject)lGt,"used_lGt");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),690,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
691 ierr = MatView(lGt,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),691,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
692 }
693
694 /* Get primal dofs (if any) */
695 cum = 0;
696 for (i=0;i<ne;i++) {
697 if (PetscUnlikely(PetscBTLookup(bte,i))__builtin_expect(!!(PetscBTLookup(bte,i)),0)) marks[cum++] = i;
698 }
699 if (fl2g) {
700 ierr = ISLocalToGlobalMappingApply(fl2g,cum,marks,marks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),700,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
701 }
702 ierr = ISCreateGeneral(comm,cum,marks,PETSC_COPY_VALUES,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),702,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
703 if (print) {
704 ierr = PetscObjectSetName((PetscObject)primals,"prescribed_primal_dofs");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),704,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
705 ierr = ISView(primals,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),705,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
706 }
707 ierr = PetscBTDestroy(&bte);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),707,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
708 /* TODO: what if the user passed in some of them ? */
709 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),709,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
710 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),710,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
711
712 /* Compute edge connectivity */
713 ierr = PetscObjectSetOptionsPrefix((PetscObject)lG,"econn_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),713,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
714 ierr = MatMatMultSymbolic(lG,lGt,PETSC_DEFAULT-2,&conn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),714,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
715 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),715,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
716 if (fl2g) {
717 PetscBT btf;
718 PetscInt *iia,*jja,*iiu,*jju;
719 PetscBool rest = PETSC_FALSE,free = PETSC_FALSE;
720
721 /* create CSR for all local dofs */
722 ierr = PetscMalloc1(n+1,&iia)PetscMallocA(1,PETSC_FALSE,722,__func__,"/sandbox/petsc/petsc.master/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),722,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
723 if (pcbddc->mat_graph->nvtxs_csr) { /* the user has passed in a CSR graph */
724 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),724,__func__,"/sandbox/petsc/petsc.master/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)
;
725 iiu = pcbddc->mat_graph->xadj;
726 jju = pcbddc->mat_graph->adjncy;
727 } else if (pcbddc->use_local_adj) {
728 rest = PETSC_TRUE;
729 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),729,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
730 } else {
731 free = PETSC_TRUE;
732 ierr = PetscMalloc2(n+1,&iiu,n,&jju)PetscMallocA(2,PETSC_FALSE,732,__func__,"/sandbox/petsc/petsc.master/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),732,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
733 iiu[0] = 0;
734 for (i=0;i<n;i++) {
735 iiu[i+1] = i+1;
736 jju[i] = -1;
737 }
738 }
739
740 /* import sizes of CSR */
741 iia[0] = 0;
742 for (i=0;i<n;i++) iia[i+1] = iiu[i+1]-iiu[i];
743
744 /* overwrite entries corresponding to the Nedelec field */
745 ierr = PetscBTCreate(n,&btf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),745,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
746 ierr = ISGetIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),746,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
747 for (i=0;i<ne;i++) {
748 ierr = PetscBTSet(btf,idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),748,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
749 iia[idxs[i]+1] = ii[i+1]-ii[i];
750 }
751
752 /* iia in CSR */
753 for (i=0;i<n;i++) iia[i+1] += iia[i];
754
755 /* jja in CSR */
756 ierr = PetscMalloc1(iia[n],&jja)PetscMallocA(1,PETSC_FALSE,756,__func__,"/sandbox/petsc/petsc.master/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),756,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
757 for (i=0;i<n;i++)
758 if (!PetscBTLookup(btf,i))
759 for (j=0;j<iiu[i+1]-iiu[i];j++)
760 jja[iia[i]+j] = jju[iiu[i]+j];
761
762 /* map edge dofs connectivity */
763 if (jj) {
764 ierr = ISLocalToGlobalMappingApply(fl2g,ii[ne],jj,(PetscInt *)jj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),764,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
765 for (i=0;i<ne;i++) {
766 PetscInt e = idxs[i];
767 for (j=0;j<ii[i+1]-ii[i];j++) jja[iia[e]+j] = jj[ii[i]+j];
768 }
769 }
770 ierr = ISRestoreIndices(nedfieldlocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),770,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
771 ierr = PCBDDCSetLocalAdjacencyGraph(pc,n,iia,jja,PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),771,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
772 if (rest) {
773 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),773,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
774 }
775 if (free) {
776 ierr = PetscFree2(iiu,jju)PetscFreeA(2,776,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(iiu),&(jju))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),776,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
777 }
778 ierr = PetscBTDestroy(&btf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),778,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
779 } else {
780 ierr = PCBDDCSetLocalAdjacencyGraph(pc,n,ii,jj,PETSC_USE_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),780,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
781 }
782
783 /* Analyze interface for edge dofs */
784 ierr = PCBDDCAnalyzeInterface(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),784,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
785 pcbddc->mat_graph->twodim = PETSC_FALSE;
786
787 /* Get coarse edges in the edge space */
788 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),788,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
789 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),789,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
790
791 if (fl2g) {
792 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,allprimals,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),792,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
793 ierr = PetscMalloc1(nee,&eedges)PetscMallocA(1,PETSC_FALSE,793,__func__,"/sandbox/petsc/petsc.master/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),793,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
794 for (i=0;i<nee;i++) {
795 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,alleedges[i],&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),795,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
796 }
797 } else {
798 eedges = alleedges;
799 primals = allprimals;
800 }
801
802 /* Mark fine edge dofs with their coarse edge id */
803 ierr = PetscArrayzero(marks,ne)PetscMemzero(marks,(ne)*sizeof(*(marks)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),803,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
804 ierr = ISGetLocalSize(primals,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),804,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
805 ierr = ISGetIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),805,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
806 for (i=0;i<cum;i++) marks[idxs[i]] = nee+1;
807 ierr = ISRestoreIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),807,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
808 if (print) {
809 ierr = PetscObjectSetName((PetscObject)primals,"obtained_primal_dofs");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),809,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
810 ierr = ISView(primals,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),810,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
811 }
812
813 maxsize = 0;
814 for (i=0;i<nee;i++) {
815 PetscInt size,mark = i+1;
816
817 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),817,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
818 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),818,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
819 for (j=0;j<size;j++) marks[idxs[j]] = mark;
820 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),820,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
821 maxsize = PetscMax(maxsize,size)(((maxsize)<(size)) ? (size) : (maxsize));
822 }
823
824 /* Find coarse edge endpoints */
825 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),825,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
826 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),826,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
827 for (i=0;i<nee;i++) {
828 PetscInt mark = i+1,size;
829
830 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),830,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
831 if (!size && nedfieldlocal) continue;
832 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),832,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
833 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),833,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
834 if (print) {
835 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),835,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
836 ierr = ISView(eedges[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),836,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
837 }
838 for (j=0;j<size;j++) {
839 PetscInt k, ee = idxs[j];
840 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," idx %D\n",ee);
841 for (k=ii[ee];k<ii[ee+1];k++) {
842 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," inspect %D\n",jj[k]);
843 if (PetscBTLookup(btv,jj[k])) {
844 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," corner found (already set) %D\n",jj[k]);
845 } else if (PetscBTLookup(btvcand,jj[k])) { /* is it ok? */
846 PetscInt k2;
847 PetscBool corner = PETSC_FALSE;
848 for (k2 = iit[jj[k]];k2 < iit[jj[k]+1];k2++) {
849 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]));
850 /* it's a corner if either is connected with an edge dof belonging to a different cc or
851 if the edge dof lie on the natural part of the boundary */
852 if ((marks[jjt[k2]] && marks[jjt[k2]] != mark) || (!marks[jjt[k2]] && PetscBTLookup(btb,jjt[k2]))) {
853 corner = PETSC_TRUE;
854 break;
855 }
856 }
857 if (corner) { /* found the nodal dof corresponding to the endpoint of the edge */
858 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," corner found %D\n",jj[k]);
859 ierr = PetscBTSet(btv,jj[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),859,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
860 } else {
861 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," no corners found\n");
862 }
863 }
864 }
865 }
866 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),866,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
867 }
868 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),868,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
869 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),869,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
870 ierr = PetscBTDestroy(&btb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),870,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
871
872 /* Reset marked primal dofs */
873 ierr = ISGetLocalSize(primals,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),873,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
874 ierr = ISGetIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),874,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
875 for (i=0;i<cum;i++) marks[idxs[i]] = 0;
876 ierr = ISRestoreIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),876,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
877
878 /* Now use the initial lG */
879 ierr = MatDestroy(&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),879,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
880 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),880,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
881 lG = lGinit;
882 ierr = MatTranspose(lG,MAT_INITIAL_MATRIX,&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),882,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
883
884 /* Compute extended cols indices */
885 ierr = PetscBTCreate(nv,&btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),885,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
886 ierr = PetscBTCreate(nee,&bter);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),886,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
887 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),887,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
888 ierr = MatSeqAIJGetMaxRowNonzeros(lG,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),888,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
889 i *= maxsize;
890 ierr = PetscCalloc1(nee,&extcols)PetscMallocA(1,PETSC_TRUE,890,__func__,"/sandbox/petsc/petsc.master/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),890,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
891 ierr = PetscMalloc2(i,&extrow,i,&gidxs)PetscMallocA(2,PETSC_FALSE,891,__func__,"/sandbox/petsc/petsc.master/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),891,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
892 eerr = PETSC_FALSE;
893 for (i=0;i<nee;i++) {
894 PetscInt size,found = 0;
895
896 cum = 0;
897 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),897,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
898 if (!size && nedfieldlocal) continue;
899 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),899,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
900 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),900,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
901 ierr = PetscBTMemzero(nv,btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),901,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
902 for (j=0;j<size;j++) {
903 PetscInt k,ee = idxs[j];
904 for (k=ii[ee];k<ii[ee+1];k++) {
905 PetscInt vv = jj[k];
906 if (!PetscBTLookup(btv,vv)) extrow[cum++] = vv;
907 else if (!PetscBTLookupSet(btvc,vv)) found++;
908 }
909 }
910 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),910,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
911 ierr = PetscSortRemoveDupsInt(&cum,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),911,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
912 ierr = ISLocalToGlobalMappingApply(vl2g,cum,extrow,gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),912,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
913 ierr = PetscSortIntWithArray(cum,gidxs,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),913,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
914 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),914,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
915 /* it may happen that endpoints are not defined at this point
916 if it is the case, mark this edge for a second pass */
917 if (cum != size -1 || found != 2) {
918 ierr = PetscBTSet(bter,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),918,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
919 if (print) {
920 ierr = PetscObjectSetName((PetscObject)eedges[i],"error_edge");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),920,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
921 ierr = ISView(eedges[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),921,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
922 ierr = PetscObjectSetName((PetscObject)extcols[i],"error_extcol");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),922,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
923 ierr = ISView(extcols[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),923,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
924 }
925 eerr = PETSC_TRUE;
926 }
927 }
928 /* if (eerr) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected SIZE OF EDGE > EXTCOL FIRST PASS"); */
929 ierr = MPIU_Allreduce(&eerr,&done,1,MPIU_BOOL,MPI_LOR,comm)(PetscAllreduceBarrierCheck(comm,1,929,__func__,"/sandbox/petsc/petsc.master/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),929,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
930 if (done) {
931 PetscInt *newprimals;
932
933 ierr = PetscMalloc1(ne,&newprimals)PetscMallocA(1,PETSC_FALSE,933,__func__,"/sandbox/petsc/petsc.master/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),933,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
934 ierr = ISGetLocalSize(primals,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),934,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
935 ierr = ISGetIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),935,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
936 ierr = PetscArraycpy(newprimals,idxs,cum)((sizeof(*(newprimals)) != sizeof(*(idxs))) || PetscMemcpy(newprimals
,idxs,(cum)*sizeof(*(newprimals))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),936,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
937 ierr = ISRestoreIndices(primals,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),937,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
938 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),938,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
939 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"DOING SECOND PASS (eerr %D)\n",eerr);
940 for (i=0;i<nee;i++) {
941 PetscBool has_candidates = PETSC_FALSE;
942 if (PetscBTLookup(bter,i)) {
943 PetscInt size,mark = i+1;
944
945 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),945,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
946 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),946,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
947 /* for (j=0;j<size;j++) newprimals[cum++] = idxs[j]; */
948 for (j=0;j<size;j++) {
949 PetscInt k,ee = idxs[j];
950 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001),"Inspecting edge dof %D [%D %D)\n",ee,ii[ee],ii[ee+1]);
951 for (k=ii[ee];k<ii[ee+1];k++) {
952 /* set all candidates located on the edge as corners */
953 if (PetscBTLookup(btvcand,jj[k])) {
954 PetscInt k2,vv = jj[k];
955 has_candidates = PETSC_TRUE;
956 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Candidate set to vertex %D\n",vv);
957 ierr = PetscBTSet(btv,vv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),957,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
958 /* set all edge dofs connected to candidate as primals */
959 for (k2=iit[vv];k2<iit[vv+1];k2++) {
960 if (marks[jjt[k2]] == mark) {
961 PetscInt k3,ee2 = jjt[k2];
962 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Connected edge dof set to primal %D\n",ee2);
963 newprimals[cum++] = ee2;
964 /* finally set the new corners */
965 for (k3=ii[ee2];k3<ii[ee2+1];k3++) {
966 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Connected nodal dof set to vertex %D\n",jj[k3]);
967 ierr = PetscBTSet(btv,jj[k3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),967,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
968 }
969 }
970 }
971 } else {
972 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Not a candidate vertex %D\n",jj[k]);
973 }
974 }
975 }
976 if (!has_candidates) { /* circular edge */
977 PetscInt k, ee = idxs[0],*tmarks;
978
979 ierr = PetscCalloc1(ne,&tmarks)PetscMallocA(1,PETSC_TRUE,979,__func__,"/sandbox/petsc/petsc.master/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),979,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
980 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Circular edge %D\n",i);
981 for (k=ii[ee];k<ii[ee+1];k++) {
982 PetscInt k2;
983 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Set to corner %D\n",jj[k]);
984 ierr = PetscBTSet(btv,jj[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),984,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
985 for (k2=iit[jj[k]];k2<iit[jj[k]+1];k2++) tmarks[jjt[k2]]++;
986 }
987 for (j=0;j<size;j++) {
988 if (tmarks[idxs[j]] > 1) {
989 if (print) PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001)," Edge dof set to primal %D\n",idxs[j]);
990 newprimals[cum++] = idxs[j];
991 }
992 }
993 ierr = PetscFree(tmarks)((*PetscTrFree)((void*)(tmarks),993,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tmarks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),993,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
994 }
995 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),995,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
996 }
997 ierr = ISDestroy(&extcols[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),997,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
998 }
999 ierr = PetscFree(extcols)((*PetscTrFree)((void*)(extcols),999,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extcols) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),999,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1000 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),1000,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1001 ierr = PetscSortRemoveDupsInt(&cum,newprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1001,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1002 if (fl2g) {
1003 ierr = ISLocalToGlobalMappingApply(fl2g,cum,newprimals,newprimals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1003,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1004 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1004,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1005 for (i=0;i<nee;i++) {
1006 ierr = ISDestroy(&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1006,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1007 }
1008 ierr = PetscFree(eedges)((*PetscTrFree)((void*)(eedges),1008,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eedges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1008,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1009 }
1010 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),1010,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1011 ierr = ISCreateGeneral(comm,cum,newprimals,PETSC_COPY_VALUES,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1011,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1012 ierr = PetscFree(newprimals)((*PetscTrFree)((void*)(newprimals),1012,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((newprimals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1012,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1013 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1013,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1014 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1014,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1015 ierr = PCBDDCAnalyzeInterface(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1015,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1016 pcbddc->mat_graph->twodim = PETSC_FALSE;
1017 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),1017,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1018 if (fl2g) {
1019 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,allprimals,&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1019,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1020 ierr = PetscMalloc1(nee,&eedges)PetscMallocA(1,PETSC_FALSE,1020,__func__,"/sandbox/petsc/petsc.master/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),1020,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1021 for (i=0;i<nee;i++) {
1022 ierr = ISGlobalToLocalMappingApplyIS(fl2g,IS_GTOLM_DROP,alleedges[i],&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1022,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1023 }
1024 } else {
1025 eedges = alleedges;
1026 primals = allprimals;
1027 }
1028 ierr = PetscCalloc1(nee,&extcols)PetscMallocA(1,PETSC_TRUE,1028,__func__,"/sandbox/petsc/petsc.master/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),1028,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1029
1030 /* Mark again */
1031 ierr = PetscArrayzero(marks,ne)PetscMemzero(marks,(ne)*sizeof(*(marks)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1031,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1032 for (i=0;i<nee;i++) {
1033 PetscInt size,mark = i+1;
1034
1035 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1035,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1036 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1036,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1037 for (j=0;j<size;j++) marks[idxs[j]] = mark;
1038 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1038,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1039 }
1040 if (print) {
1041 ierr = PetscObjectSetName((PetscObject)primals,"obtained_primal_dofs_secondpass");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1041,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1042 ierr = ISView(primals,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1042,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1043 }
1044
1045 /* Recompute extended cols */
1046 eerr = PETSC_FALSE;
1047 for (i=0;i<nee;i++) {
1048 PetscInt size;
1049
1050 cum = 0;
1051 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1051,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1052 if (!size && nedfieldlocal) continue;
1053 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),1053,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
1054 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1054,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1055 for (j=0;j<size;j++) {
1056 PetscInt k,ee = idxs[j];
1057 for (k=ii[ee];k<ii[ee+1];k++) if (!PetscBTLookup(btv,jj[k])) extrow[cum++] = jj[k];
1058 }
1059 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1059,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1060 ierr = PetscSortRemoveDupsInt(&cum,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1060,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1061 ierr = ISLocalToGlobalMappingApply(vl2g,cum,extrow,gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1061,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1062 ierr = PetscSortIntWithArray(cum,gidxs,extrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1062,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1063 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),1063,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1064 if (cum != size -1) {
1065 if (print) {
1066 ierr = PetscObjectSetName((PetscObject)eedges[i],"error_edge_secondpass");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1066,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1067 ierr = ISView(eedges[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1067,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1068 ierr = PetscObjectSetName((PetscObject)extcols[i],"error_extcol_secondpass");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1068,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1069 ierr = ISView(extcols[i],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1069,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1070 }
1071 eerr = PETSC_TRUE;
1072 }
1073 }
1074 }
1075 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),1075,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1076 ierr = PetscFree2(extrow,gidxs)PetscFreeA(2,1076,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(extrow),&(gidxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1076,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1077 ierr = PetscBTDestroy(&bter);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1077,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1078 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),1078,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
1079 /* an error should not occur at this point */
1080 if (eerr) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected SIZE OF EDGE > EXTCOL SECOND PASS")return PetscError(((MPI_Comm)0x44000001),1080,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected SIZE OF EDGE > EXTCOL SECOND PASS"
)
;
1081
1082 /* Check the number of endpoints */
1083 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),1083,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1084 ierr = PetscMalloc1(2*nee,&corners)PetscMallocA(1,PETSC_FALSE,1084,__func__,"/sandbox/petsc/petsc.master/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),1084,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1085 ierr = PetscMalloc1(nee,&cedges)PetscMallocA(1,PETSC_FALSE,1085,__func__,"/sandbox/petsc/petsc.master/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),1085,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1086 for (i=0;i<nee;i++) {
1087 PetscInt size, found = 0, gc[2];
1088
1089 /* init with defaults */
1090 cedges[i] = corners[i*2] = corners[i*2+1] = -1;
1091 ierr = ISGetLocalSize(eedges[i],&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1091,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1092 if (!size && nedfieldlocal) continue;
1093 if (!size) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected zero sized edge %D",i)return PetscError(((MPI_Comm)0x44000001),1093,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Unexpected zero sized edge %D",i)
;
1094 ierr = ISGetIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1094,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1095 ierr = PetscBTMemzero(nv,btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1095,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1096 for (j=0;j<size;j++) {
1097 PetscInt k,ee = idxs[j];
1098 for (k=ii[ee];k<ii[ee+1];k++) {
1099 PetscInt vv = jj[k];
1100 if (PetscBTLookup(btv,vv) && !PetscBTLookupSet(btvc,vv)) {
1101 if (found == 2) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Found more then two corners for edge %D",i)return PetscError(((MPI_Comm)0x44000001),1101,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Found more then two corners for edge %D"
,i)
;
1102 corners[i*2+found++] = vv;
1103 }
1104 }
1105 }
1106 if (found != 2) {
1107 PetscInt e;
1108 if (fl2g) {
1109 ierr = ISLocalToGlobalMappingApply(fl2g,1,idxs,&e);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1109,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1110 } else {
1111 e = idxs[0];
1112 }
1113 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),1113,__func__,"/sandbox/petsc/petsc.master/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])
;
1114 }
1115
1116 /* get primal dof index on this coarse edge */
1117 ierr = ISLocalToGlobalMappingApply(vl2g,2,corners+2*i,gc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1117,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1118 if (gc[0] > gc[1]) {
1119 PetscInt swap = corners[2*i];
1120 corners[2*i] = corners[2*i+1];
1121 corners[2*i+1] = swap;
1122 }
1123 cedges[i] = idxs[size-1];
1124 ierr = ISRestoreIndices(eedges[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1124,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1125 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]);
1126 }
1127 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),1127,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1128 ierr = PetscBTDestroy(&btvc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1128,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1129
1130#if defined(PETSC_USE_DEBUG1)
1131 /* Inspects columns of lG (rows of lGt) and make sure the change of basis will
1132 not interfere with neighbouring coarse edges */
1133 ierr = PetscMalloc1(nee+1,&emarks)PetscMallocA(1,PETSC_FALSE,1133,__func__,"/sandbox/petsc/petsc.master/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),1133,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1134 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),1134,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1135 for (i=0;i<nv;i++) {
1136 PetscInt emax = 0,eemax = 0;
1137
1138 if (ii[i+1]==ii[i] || PetscBTLookup(btv,i)) continue;
1139 ierr = PetscArrayzero(emarks,nee+1)PetscMemzero(emarks,(nee+1)*sizeof(*(emarks)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1139,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1140 for (j=ii[i];j<ii[i+1];j++) emarks[marks[jj[j]]]++;
1141 for (j=1;j<nee+1;j++) {
1142 if (emax < emarks[j]) {
1143 emax = emarks[j];
1144 eemax = j;
1145 }
1146 }
1147 /* not relevant for edges */
1148 if (!eemax) continue;
1149
1150 for (j=ii[i];j<ii[i+1];j++) {
1151 if (marks[jj[j]] && marks[jj[j]] != eemax) {
1152 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),1152,__func__,"/sandbox/petsc/petsc.master/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])
;
1153 }
1154 }
1155 }
1156 ierr = PetscFree(emarks)((*PetscTrFree)((void*)(emarks),1156,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((emarks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1156,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1157 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),1157,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1158#endif
1159
1160 /* Compute extended rows indices for edge blocks of the change of basis */
1161 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),1161,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1162 ierr = MatSeqAIJGetMaxRowNonzeros(lGt,&extmem);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1162,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1163 extmem *= maxsize;
1164 ierr = PetscMalloc1(extmem*nee,&extrow)PetscMallocA(1,PETSC_FALSE,1164,__func__,"/sandbox/petsc/petsc.master/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),1164,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1165 ierr = PetscMalloc1(nee,&extrows)PetscMallocA(1,PETSC_FALSE,1165,__func__,"/sandbox/petsc/petsc.master/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),1165,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1166 ierr = PetscCalloc1(nee,&extrowcum)PetscMallocA(1,PETSC_TRUE,1166,__func__,"/sandbox/petsc/petsc.master/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),1166,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1167 for (i=0;i<nv;i++) {
1168 PetscInt mark = 0,size,start;
1169
1170 if (ii[i+1]==ii[i] || PetscBTLookup(btv,i)) continue;
1171 for (j=ii[i];j<ii[i+1];j++)
1172 if (marks[jj[j]] && !mark)
1173 mark = marks[jj[j]];
1174
1175 /* not relevant */
1176 if (!mark) continue;
1177
1178 /* import extended row */
1179 mark--;
1180 start = mark*extmem+extrowcum[mark];
1181 size = ii[i+1]-ii[i];
1182 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),1182,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Not enough memory allocated %D > %D"
,extrowcum[mark] + size,extmem)
;
1183 ierr = PetscArraycpy(extrow+start,jj+ii[i],size)((sizeof(*(extrow+start)) != sizeof(*(jj+ii[i]))) || PetscMemcpy
(extrow+start,jj+ii[i],(size)*sizeof(*(extrow+start))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1183,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1184 extrowcum[mark] += size;
1185 }
1186 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),1186,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1187 ierr = MatDestroy(&lGt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1187,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1188 ierr = PetscFree(marks)((*PetscTrFree)((void*)(marks),1188,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((marks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1188,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1189
1190 /* Compress extrows */
1191 cum = 0;
1192 for (i=0;i<nee;i++) {
1193 PetscInt size = extrowcum[i],*start = extrow + i*extmem;
1194 ierr = PetscSortRemoveDupsInt(&size,start);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1194,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1195 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),1195,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1196 cum = PetscMax(cum,size)(((cum)<(size)) ? (size) : (cum));
1197 }
1198 ierr = PetscFree(extrowcum)((*PetscTrFree)((void*)(extrowcum),1198,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extrowcum) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1198,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1199 ierr = PetscBTDestroy(&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1199,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1200 ierr = PetscBTDestroy(&btvcand);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1200,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1201
1202 /* Workspace for lapack inner calls and VecSetValues */
1203 ierr = PetscMalloc2((5+cum+maxsize)*maxsize,&work,maxsize,&rwork)PetscMallocA(2,PETSC_FALSE,1203,__func__,"/sandbox/petsc/petsc.master/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),1203,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1204
1205 /* Create change of basis matrix (preallocation can be improved) */
1206 ierr = MatCreate(comm,&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1206,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1207 ierr = MatSetSizes(T,pc->pmat->rmap->n,pc->pmat->rmap->n,
1208 pc->pmat->rmap->N,pc->pmat->rmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1209 ierr = MatSetType(T,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1209,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1210 ierr = MatSeqAIJSetPreallocation(T,10,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1210,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1211 ierr = MatMPIAIJSetPreallocation(T,10,NULL((void*)0),10,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1211,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1212 ierr = MatSetLocalToGlobalMapping(T,al2g,al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1212,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1213 ierr = MatSetOption(T,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1213,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1214 ierr = MatSetOption(T,MAT_ROW_ORIENTED,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1214,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1215 ierr = ISLocalToGlobalMappingDestroy(&al2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1215,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1216
1217 /* Defaults to identity */
1218 ierr = MatCreateVecs(pc->pmat,&tvec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1218,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1219 ierr = VecSet(tvec,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1219,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1220 ierr = MatDiagonalSet(T,tvec,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1220,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1221 ierr = VecDestroy(&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1221,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1222
1223 /* Create discrete gradient for the coarser level if needed */
1224 ierr = MatDestroy(&pcbddc->nedcG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1224,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1225 ierr = ISDestroy(&pcbddc->nedclocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1225,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1226 if (pcbddc->current_level < pcbddc->max_levels) {
1227 ISLocalToGlobalMapping cel2g,cvl2g;
1228 IS wis,gwis;
1229 PetscInt cnv,cne;
1230
1231 ierr = ISCreateGeneral(comm,nee,cedges,PETSC_COPY_VALUES,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1231,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1232 if (fl2g) {
1233 ierr = ISLocalToGlobalMappingApplyIS(fl2g,wis,&pcbddc->nedclocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1233,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1234 } else {
1235 ierr = PetscObjectReference((PetscObject)wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1235,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1236 pcbddc->nedclocal = wis;
1237 }
1238 ierr = ISLocalToGlobalMappingApplyIS(el2g,wis,&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1238,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1239 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1239,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1240 ierr = ISRenumber(gwis,NULL((void*)0),&cne,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1240,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1241 ierr = ISLocalToGlobalMappingCreateIS(wis,&cel2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1241,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1242 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1242,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1243 ierr = ISDestroy(&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1243,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1244
1245 ierr = ISCreateGeneral(comm,2*nee,corners,PETSC_USE_POINTER,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1245,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1246 ierr = ISLocalToGlobalMappingApplyIS(vl2g,wis,&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1246,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1247 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1247,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1248 ierr = ISRenumber(gwis,NULL((void*)0),&cnv,&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1248,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1249 ierr = ISLocalToGlobalMappingCreateIS(wis,&cvl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1249,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1250 ierr = ISDestroy(&wis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1251 ierr = ISDestroy(&gwis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1251,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1252
1253 ierr = MatCreate(comm,&pcbddc->nedcG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1253,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1254 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),1254,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1255 ierr = MatSetType(pcbddc->nedcG,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1255,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1256 ierr = MatSeqAIJSetPreallocation(pcbddc->nedcG,2,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1256,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1257 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),1257,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1258 ierr = MatSetLocalToGlobalMapping(pcbddc->nedcG,cel2g,cvl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1258,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1259 ierr = ISLocalToGlobalMappingDestroy(&cel2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1259,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1260 ierr = ISLocalToGlobalMappingDestroy(&cvl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1260,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1261 }
1262 ierr = ISLocalToGlobalMappingDestroy(&vl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1262,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1263
1264#if defined(PRINT_GDET)
1265 inc = 0;
1266 lev = pcbddc->current_level;
1267#endif
1268
1269 /* Insert values in the change of basis matrix */
1270 for (i=0;i<nee;i++) {
1271 Mat Gins = NULL((void*)0), GKins = NULL((void*)0);
1272 IS cornersis = NULL((void*)0);
1273 PetscScalar cvals[2];
1274
1275 if (pcbddc->nedcG) {
1276 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),1276,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1277 }
1278 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),1278,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1279 if (Gins && GKins) {
1280 const PetscScalar *data;
1281 const PetscInt *rows,*cols;
1282 PetscInt nrh,nch,nrc,ncc;
1283
1284 ierr = ISGetIndices(eedges[i],&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1284,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1285 /* H1 */
1286 ierr = ISGetIndices(extrows[i],&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1286,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1287 ierr = MatGetSize(Gins,&nrh,&nch);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1287,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1288 ierr = MatDenseGetArrayRead(Gins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1288,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1289 ierr = MatSetValuesLocal(T,nrh,rows,nch,cols,data,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1289,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1290 ierr = MatDenseRestoreArrayRead(Gins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1290,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1291 ierr = ISRestoreIndices(extrows[i],&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1291,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1292 /* complement */
1293 ierr = MatGetSize(GKins,&nrc,&ncc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1293,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1294 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),1294,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Constant function has not been generated for coarse edge %D"
,i)
;
1295 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),1295,__func__,"/sandbox/petsc/petsc.master/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)
;
1296 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),1296,__func__,"/sandbox/petsc/petsc.master/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)
;
1297 ierr = MatDenseGetArrayRead(GKins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1297,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1298 ierr = MatSetValuesLocal(T,nrc,cols,ncc,cols+nch,data,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1298,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1299 ierr = MatDenseRestoreArrayRead(GKins,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1299,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1300
1301 /* coarse discrete gradient */
1302 if (pcbddc->nedcG) {
1303 PetscInt cols[2];
1304
1305 cols[0] = 2*i;
1306 cols[1] = 2*i+1;
1307 ierr = MatSetValuesLocal(pcbddc->nedcG,1,&i,2,cols,cvals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1307,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1308 }
1309 ierr = ISRestoreIndices(eedges[i],&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1310 }
1311 ierr = ISDestroy(&extrows[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1311,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1312 ierr = ISDestroy(&extcols[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1312,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1313 ierr = ISDestroy(&cornersis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1313,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1314 ierr = MatDestroy(&Gins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1314,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1315 ierr = MatDestroy(&GKins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1315,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1316 }
1317 ierr = ISLocalToGlobalMappingDestroy(&el2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1317,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1318
1319 /* Start assembling */
1320 ierr = MatAssemblyBegin(T,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1320,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1321 if (pcbddc->nedcG) {
1322 ierr = MatAssemblyBegin(pcbddc->nedcG,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1322,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1323 }
1324
1325 /* Free */
1326 if (fl2g) {
1327 ierr = ISDestroy(&primals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1327,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1328 for (i=0;i<nee;i++) {
1329 ierr = ISDestroy(&eedges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1329,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1330 }
1331 ierr = PetscFree(eedges)((*PetscTrFree)((void*)(eedges),1331,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eedges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1331,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1332 }
1333
1334 /* hack mat_graph with primal dofs on the coarse edges */
1335 {
1336 PCBDDCGraph graph = pcbddc->mat_graph;
1337 PetscInt *oqueue = graph->queue;
1338 PetscInt *ocptr = graph->cptr;
1339 PetscInt ncc,*idxs;
1340
1341 /* find first primal edge */
1342 if (pcbddc->nedclocal) {
1343 ierr = ISGetIndices(pcbddc->nedclocal,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1343,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1344 } else {
1345 if (fl2g) {
1346 ierr = ISLocalToGlobalMappingApply(fl2g,nee,cedges,cedges);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1346,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1347 }
1348 idxs = cedges;
1349 }
1350 cum = 0;
1351 while (cum < nee && cedges[cum] < 0) cum++;
1352
1353 /* adapt connected components */
1354 ierr = PetscMalloc2(graph->nvtxs+1,&graph->cptr,ocptr[graph->ncc],&graph->queue)PetscMallocA(2,PETSC_FALSE,1354,__func__,"/sandbox/petsc/petsc.master/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),1354,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1355 graph->cptr[0] = 0;
1356 for (i=0,ncc=0;i<graph->ncc;i++) {
1357 PetscInt lc = ocptr[i+1]-ocptr[i];
1358 if (cum != nee && oqueue[ocptr[i+1]-1] == cedges[cum]) { /* this cc has a primal dof */
1359 graph->cptr[ncc+1] = graph->cptr[ncc]+1;
1360 graph->queue[graph->cptr[ncc]] = cedges[cum];
1361 ncc++;
1362 lc--;
1363 cum++;
1364 while (cum < nee && cedges[cum] < 0) cum++;
1365 }
1366 graph->cptr[ncc+1] = graph->cptr[ncc] + lc;
1367 for (j=0;j<lc;j++) graph->queue[graph->cptr[ncc]+j] = oqueue[ocptr[i]+j];
1368 ncc++;
1369 }
1370 graph->ncc = ncc;
1371 if (pcbddc->nedclocal) {
1372 ierr = ISRestoreIndices(pcbddc->nedclocal,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1373 }
1374 ierr = PetscFree2(ocptr,oqueue)PetscFreeA(2,1374,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(ocptr),&(oqueue))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1374,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1375 }
1376 ierr = ISLocalToGlobalMappingDestroy(&fl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1376,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1377 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),1377,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1378 ierr = PCBDDCGraphResetCSR(pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1378,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1379 ierr = MatDestroy(&conn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1379,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1380
1381 ierr = ISDestroy(&nedfieldlocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1381,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1382 ierr = PetscFree(extrow)((*PetscTrFree)((void*)(extrow),1382,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extrow) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1382,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1383 ierr = PetscFree2(work,rwork)PetscFreeA(2,1383,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(work),&(rwork))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1383,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1384 ierr = PetscFree(corners)((*PetscTrFree)((void*)(corners),1384,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((corners) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1384,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1385 ierr = PetscFree(cedges)((*PetscTrFree)((void*)(cedges),1385,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((cedges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1385,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1386 ierr = PetscFree(extrows)((*PetscTrFree)((void*)(extrows),1386,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extrows) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1386,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1387 ierr = PetscFree(extcols)((*PetscTrFree)((void*)(extcols),1387,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((extcols) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1387,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1388 ierr = MatDestroy(&lG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1388,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1389
1390 /* Complete assembling */
1391 ierr = MatAssemblyEnd(T,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1391,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1392 if (pcbddc->nedcG) {
1393 ierr = MatAssemblyEnd(pcbddc->nedcG,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1393,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1394#if 0
1395 ierr = PetscObjectSetName((PetscObject)pcbddc->nedcG,"coarse_G");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1395,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1396 ierr = MatView(pcbddc->nedcG,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1396,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1397#endif
1398 }
1399
1400 /* set change of basis */
1401 ierr = PCBDDCSetChangeOfBasisMat(pc,T,singular);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1401,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1402 ierr = MatDestroy(&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1402,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1403
1404 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1405}
1406
1407/* the near-null space of BDDC carries information on quadrature weights,
1408 and these can be collinear -> so cheat with MatNullSpaceCreate
1409 and create a suitable set of basis vectors first */
1410PetscErrorCode PCBDDCNullSpaceCreate(MPI_Comm comm, PetscBool has_const, PetscInt nvecs, Vec quad_vecs[], MatNullSpace *nnsp)
1411{
1412 PetscErrorCode ierr;
1413 PetscInt i;
1414
1415 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1415; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1416 for (i=0;i<nvecs;i++) {
1417 PetscInt first,last;
1418
1419 ierr = VecGetOwnershipRange(quad_vecs[i],&first,&last);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1419,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1420 if (last-first < 2*nvecs && has_const) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not implemented")return PetscError(((MPI_Comm)0x44000001),1420,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not implemented")
;
1421 if (i>=first && i < last) {
1422 PetscScalar *data;
1423 ierr = VecGetArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1423,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1424 if (!has_const) {
1425 data[i-first] = 1.;
1426 } else {
1427 data[2*i-first] = 1./PetscSqrtReal(2.)sqrt(2.);
1428 data[2*i-first+1] = -1./PetscSqrtReal(2.)sqrt(2.);
1429 }
1430 ierr = VecRestoreArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1430,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1431 }
1432 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),1432,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1433 }
1434 ierr = MatNullSpaceCreate(comm,has_const,nvecs,quad_vecs,nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1434,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1435 for (i=0;i<nvecs;i++) { /* reset vectors */
1436 PetscInt first,last;
1437 ierr = VecLockReadPop(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1437,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1438 ierr = VecGetOwnershipRange(quad_vecs[i],&first,&last);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1438,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1439 if (i>=first && i < last) {
1440 PetscScalar *data;
1441 ierr = VecGetArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1441,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1442 if (!has_const) {
1443 data[i-first] = 0.;
1444 } else {
1445 data[2*i-first] = 0.;
1446 data[2*i-first+1] = 0.;
1447 }
1448 ierr = VecRestoreArray(quad_vecs[i],&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1448,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1449 }
1450 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),1450,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1451 ierr = VecLockReadPush(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1451,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1452 }
1453 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1454}
1455
1456PetscErrorCode PCBDDCComputeNoNetFlux(Mat A, Mat divudotp, PetscBool transpose, IS vl2l, PCBDDCGraph graph, MatNullSpace *nnsp)
1457{
1458 Mat loc_divudotp;
1459 Vec p,v,vins,quad_vec,*quad_vecs;
1460 ISLocalToGlobalMapping map;
1461 PetscScalar *vals;
1462 const PetscScalar *array;
1463 PetscInt i,maxneighs,maxsize,*gidxs;
1464 PetscInt n_neigh,*neigh,*n_shared,**shared;
1465 PetscMPIInt rank;
1466 PetscErrorCode ierr;
1467
1468 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1468; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1469 ierr = ISLocalToGlobalMappingGetInfo(graph->l2gmap,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1469,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1470 ierr = MPIU_Allreduce(&n_neigh,&maxneighs,1,MPIU_INT,MPI_MAX,PetscObjectComm((PetscObject)A))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)A),1
,1470,__func__,"/sandbox/petsc/petsc.master/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),1470,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1471 if (!maxneighs) {
1472 ierr = ISLocalToGlobalMappingRestoreInfo(graph->l2gmap,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1472,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1473 *nnsp = NULL((void*)0);
1474 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1475 }
1476 maxsize = 0;
1477 for (i=0;i<n_neigh;i++) maxsize = PetscMax(n_shared[i],maxsize)(((n_shared[i])<(maxsize)) ? (maxsize) : (n_shared[i]));
1478 ierr = PetscMalloc2(maxsize,&gidxs,maxsize,&vals)PetscMallocA(2,PETSC_FALSE,1478,__func__,"/sandbox/petsc/petsc.master/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),1478,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1479 /* create vectors to hold quadrature weights */
1480 ierr = MatCreateVecs(A,&quad_vec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1480,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1481 if (!transpose) {
1482 ierr = MatGetLocalToGlobalMapping(A,&map,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1482,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1483 } else {
1484 ierr = MatGetLocalToGlobalMapping(A,NULL((void*)0),&map);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1484,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1485 }
1486 ierr = VecDuplicateVecs(quad_vec,maxneighs,&quad_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1486,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1487 ierr = VecDestroy(&quad_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1487,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1488 ierr = PCBDDCNullSpaceCreate(PetscObjectComm((PetscObject)A),PETSC_FALSE,maxneighs,quad_vecs,nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1488,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1489 for (i=0;i<maxneighs;i++) {
1490 ierr = VecLockReadPop(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1490,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1491 }
1492
1493 /* compute local quad vec */
1494 ierr = MatISGetLocalMat(divudotp,&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1494,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1495 if (!transpose) {
1496 ierr = MatCreateVecs(loc_divudotp,&v,&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1496,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1497 } else {
1498 ierr = MatCreateVecs(loc_divudotp,&p,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1498,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1499 }
1500 ierr = VecSet(p,1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1500,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1501 if (!transpose) {
1502 ierr = MatMultTranspose(loc_divudotp,p,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1502,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1503 } else {
1504 ierr = MatMult(loc_divudotp,p,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1504,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1505 }
1506 if (vl2l) {
1507 Mat lA;
1508 VecScatter sc;
1509
1510 ierr = MatISGetLocalMat(A,&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1510,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1511 ierr = MatCreateVecs(lA,&vins,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1511,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1512 ierr = VecScatterCreate(v,NULL((void*)0),vins,vl2l,&sc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1512,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1513 ierr = VecScatterBegin(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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1514 ierr = VecScatterEnd(sc,v,vins,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1514,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1515 ierr = VecScatterDestroy(&sc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1515,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1516 } else {
1517 vins = v;
1518 }
1519 ierr = VecGetArrayRead(vins,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1519,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1520 ierr = VecDestroy(&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1520,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1521
1522 /* insert in global quadrature vecs */
1523 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1523,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1524 for (i=0;i<n_neigh;i++) {
1525 const PetscInt *idxs;
1526 PetscInt idx,nn,j;
1527
1528 idxs = shared[i];
1529 nn = n_shared[i];
1530 for (j=0;j<nn;j++) vals[j] = array[idxs[j]];
1531 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),1531,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1532 idx = -(idx+1);
1533 ierr = ISLocalToGlobalMappingApply(map,nn,idxs,gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1533,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1534 ierr = VecSetValues(quad_vecs[idx],nn,gidxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1534,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1535 }
1536 ierr = ISLocalToGlobalMappingRestoreInfo(graph->l2gmap,&n_neigh,&neigh,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1536,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1537 ierr = VecRestoreArrayRead(vins,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1537,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1538 if (vl2l) {
1539 ierr = VecDestroy(&vins);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1539,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1540 }
1541 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1541,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1542 ierr = PetscFree2(gidxs,vals)PetscFreeA(2,1542,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(gidxs),&(vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1542,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1543
1544 /* assemble near null space */
1545 for (i=0;i<maxneighs;i++) {
1546 ierr = VecAssemblyBegin(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1546,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1547 }
1548 for (i=0;i<maxneighs;i++) {
1549 ierr = VecAssemblyEnd(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1549,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1550 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),1550,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1551 ierr = VecLockReadPush(quad_vecs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1551,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1552 }
1553 ierr = VecDestroyVecs(maxneighs,&quad_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1553,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1554 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1555}
1556
1557PetscErrorCode PCBDDCAddPrimalVerticesLocalIS(PC pc, IS primalv)
1558{
1559 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
1560 PetscErrorCode ierr;
1561
1562 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1562; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1563 if (primalv) {
1564 if (pcbddc->user_primal_vertices_local) {
1565 IS list[2], newp;
1566
1567 list[0] = primalv;
1568 list[1] = pcbddc->user_primal_vertices_local;
1569 ierr = ISConcatenate(PetscObjectComm((PetscObject)pc),2,list,&newp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1569,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1570 ierr = ISSortRemoveDups(newp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1570,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1571 ierr = ISDestroy(&list[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1571,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1572 pcbddc->user_primal_vertices_local = newp;
1573 } else {
1574 ierr = PCBDDCSetPrimalVerticesLocalIS(pc,primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1574,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1575 }
1576 }
1577 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1578}
1579
1580static PetscErrorCode func_coords_private(PetscInt dim, PetscReal t, const PetscReal X[], PetscInt Nf, PetscScalar *out, void *ctx)
1581{
1582 PetscInt f, *comp = (PetscInt *)ctx;
1583
1584 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1584; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1585 for (f=0;f<Nf;f++) out[f] = X[*comp];
1586 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1587}
1588
1589PetscErrorCode PCBDDCComputeLocalTopologyInfo(PC pc)
1590{
1591 PetscErrorCode ierr;
1592 Vec local,global;
1593 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
1594 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
1595 PetscBool monolithic = PETSC_FALSE;
1596
1597 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1597; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1598 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),1598,__func__,"/sandbox/petsc/petsc.master/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),1598,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1599 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),1599,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1600 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1600,__func__,"/sandbox/petsc/petsc.master/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),1600,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1601 /* need to convert from global to local topology information and remove references to information in global ordering */
1602 ierr = MatCreateVecs(pc->pmat,&global,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1602,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1603 ierr = MatCreateVecs(matis->A,&local,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1603,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1604 if (monolithic) { /* just get block size to properly compute vertices */
1605 if (pcbddc->vertex_size == 1) {
1606 ierr = MatGetBlockSize(pc->pmat,&pcbddc->vertex_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1606,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1607 }
1608 goto boundary;
1609 }
1610
1611 if (pcbddc->user_provided_isfordofs) {
1612 if (pcbddc->n_ISForDofs) {
1613 PetscInt i;
1614
1615 ierr = PetscMalloc1(pcbddc->n_ISForDofs,&pcbddc->ISForDofsLocal)PetscMallocA(1,PETSC_FALSE,1615,__func__,"/sandbox/petsc/petsc.master/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),1615,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1616 for (i=0;i<pcbddc->n_ISForDofs;i++) {
1617 PetscInt bs;
1618
1619 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),1619,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1620 ierr = ISGetBlockSize(pcbddc->ISForDofs[i],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1620,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1621 ierr = ISSetBlockSize(pcbddc->ISForDofsLocal[i],bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1621,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1622 ierr = ISDestroy(&pcbddc->ISForDofs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1622,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1623 }
1624 pcbddc->n_ISForDofsLocal = pcbddc->n_ISForDofs;
1625 pcbddc->n_ISForDofs = 0;
1626 ierr = PetscFree(pcbddc->ISForDofs)((*PetscTrFree)((void*)(pcbddc->ISForDofs),1626,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcbddc->ISForDofs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1626,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1627 }
1628 } else {
1629 if (!pcbddc->n_ISForDofsLocal) { /* field split not present */
1630 DM dm;
1631
1632 ierr = MatGetDM(pc->pmat, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1632,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1633 if (!dm) {
1634 ierr = PCGetDM(pc, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1634,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1635 }
1636 if (dm) {
1637 IS *fields;
1638 PetscInt nf,i;
1639
1640 ierr = DMCreateFieldDecomposition(dm,&nf,NULL((void*)0),&fields,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1640,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1641 ierr = PetscMalloc1(nf,&pcbddc->ISForDofsLocal)PetscMallocA(1,PETSC_FALSE,1641,__func__,"/sandbox/petsc/petsc.master/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),1641,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1642 for (i=0;i<nf;i++) {
1643 PetscInt bs;
1644
1645 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,fields[i],&pcbddc->ISForDofsLocal[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1645,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1646 ierr = ISGetBlockSize(fields[i],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1646,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1647 ierr = ISSetBlockSize(pcbddc->ISForDofsLocal[i],bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1647,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1648 ierr = ISDestroy(&fields[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1648,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1649 }
1650 ierr = PetscFree(fields)((*PetscTrFree)((void*)(fields),1650,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((fields) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1650,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1651 pcbddc->n_ISForDofsLocal = nf;
1652 } else { /* See if MATIS has fields attached by the conversion from MatNest */
1653 PetscContainer c;
1654
1655 ierr = PetscObjectQuery((PetscObject)pc->pmat,"_convert_nest_lfields",(PetscObject*)&c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1655,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1656 if (c) {
1657 MatISLocalFields lf;
1658 ierr = PetscContainerGetPointer(c,(void**)&lf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1658,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1659 ierr = PCBDDCSetDofsSplittingLocal(pc,lf->nr,lf->rf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1659,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1660 } else { /* fallback, create the default fields if bs > 1 */
1661 PetscInt i, n = matis->A->rmap->n;
1662 ierr = MatGetBlockSize(pc->pmat,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1662,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1663 if (i > 1) {
1664 pcbddc->n_ISForDofsLocal = i;
1665 ierr = PetscMalloc1(pcbddc->n_ISForDofsLocal,&pcbddc->ISForDofsLocal)PetscMallocA(1,PETSC_FALSE,1665,__func__,"/sandbox/petsc/petsc.master/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),1665,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1666 for (i=0;i<pcbddc->n_ISForDofsLocal;i++) {
1667 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),1667,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1668 }
1669 }
1670 }
1671 }
1672 } else {
1673 PetscInt i;
1674 for (i=0;i<pcbddc->n_ISForDofsLocal;i++) {
1675 ierr = PCBDDCConsistencyCheckIS(pc,MPI_LAND(MPI_Op)(0x58000005),&pcbddc->ISForDofsLocal[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1675,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1676 }
1677 }
1678 }
1679
1680boundary:
1681 if (!pcbddc->DirichletBoundariesLocal && pcbddc->DirichletBoundaries) {
1682 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,pcbddc->DirichletBoundaries,&pcbddc->DirichletBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1683 } else if (pcbddc->DirichletBoundariesLocal) {
1684 ierr = PCBDDCConsistencyCheckIS(pc,MPI_LAND(MPI_Op)(0x58000005),&pcbddc->DirichletBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1684,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1685 }
1686 if (!pcbddc->NeumannBoundariesLocal && pcbddc->NeumannBoundaries) {
1687 ierr = PCBDDCGlobalToLocal(matis->rctx,global,local,pcbddc->NeumannBoundaries,&pcbddc->NeumannBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1687,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1688 } else if (pcbddc->NeumannBoundariesLocal) {
1689 ierr = PCBDDCConsistencyCheckIS(pc,MPI_LOR(MPI_Op)(0x58000007),&pcbddc->NeumannBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1689,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1690 }
1691 if (!pcbddc->user_primal_vertices_local && pcbddc->user_primal_vertices) {
1692 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),1692,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1693 }
1694 ierr = VecDestroy(&global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1694,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1695 ierr = VecDestroy(&local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1695,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1696 /* detect local disconnected subdomains if requested (use matis->A) */
1697 if (pcbddc->detect_disconnected) {
1698 IS primalv = NULL((void*)0);
1699 PetscInt i;
1700 PetscBool filter = pcbddc->detect_disconnected_filter;
1701
1702 for (i=0;i<pcbddc->n_local_subs;i++) {
1703 ierr = ISDestroy(&pcbddc->local_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1703,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1704 }
1705 ierr = PetscFree(pcbddc->local_subs)((*PetscTrFree)((void*)(pcbddc->local_subs),1705,__func__,
"/sandbox/petsc/petsc.master/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),1705,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1706 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),1706,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1707 ierr = PCBDDCAddPrimalVerticesLocalIS(pc,primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1707,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1708 ierr = ISDestroy(&primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1708,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1709 }
1710 /* early stage corner detection */
1711 {
1712 DM dm;
1713
1714 ierr = MatGetDM(pc->pmat,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1714,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1715 if (!dm) {
1716 ierr = PCGetDM(pc,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1716,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1717 }
1718 if (dm) {
1719 PetscBool isda;
1720
1721 ierr = PetscObjectTypeCompare((PetscObject)dm,DMDA"da",&isda);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1721,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1722 if (isda) {
1723 ISLocalToGlobalMapping l2l;
1724 IS corners;
1725 Mat lA;
1726 PetscBool gl,lo;
1727
1728 {
1729 Vec cvec;
1730 const PetscScalar *coords;
1731 PetscInt dof,n,cdim;
1732 PetscBool memc = PETSC_TRUE;
1733
1734 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),1734,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1735 ierr = DMGetCoordinates(dm,&cvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1735,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1736 ierr = VecGetLocalSize(cvec,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1736,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1737 ierr = VecGetBlockSize(cvec,&cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1737,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1738 n /= cdim;
1739 ierr = PetscFree(pcbddc->mat_graph->coords)((*PetscTrFree)((void*)(pcbddc->mat_graph->coords),1739
,__func__,"/sandbox/petsc/petsc.master/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),1739,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1740 ierr = PetscMalloc1(dof*n*cdim,&pcbddc->mat_graph->coords)PetscMallocA(1,PETSC_FALSE,1740,__func__,"/sandbox/petsc/petsc.master/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),1740,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1741 ierr = VecGetArrayRead(cvec,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1741,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1742#if defined(PETSC_USE_COMPLEX)
1743 memc = PETSC_FALSE;
1744#endif
1745 if (dof != 1) memc = PETSC_FALSE;
1746 if (memc) {
1747 ierr = PetscArraycpy(pcbddc->mat_graph->coords,coords,cdim*n*dof)((sizeof(*(pcbddc->mat_graph->coords)) != sizeof(*(coords
))) || PetscMemcpy(pcbddc->mat_graph->coords,coords,(cdim
*n*dof)*sizeof(*(pcbddc->mat_graph->coords))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1747,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1748 } else { /* BDDC graph does not use any blocked information, we need to replicate the data */
1749 PetscReal *bcoords = pcbddc->mat_graph->coords;
1750 PetscInt i, b, d;
1751
1752 for (i=0;i<n;i++) {
1753 for (b=0;b<dof;b++) {
1754 for (d=0;d<cdim;d++) {
1755 bcoords[i*dof*cdim + b*cdim + d] = PetscRealPart(coords[i*cdim+d])(coords[i*cdim+d]);
1756 }
1757 }
1758 }
1759 }
1760 ierr = VecRestoreArrayRead(cvec,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1760,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1761 pcbddc->mat_graph->cdim = cdim;
1762 pcbddc->mat_graph->cnloc = dof*n;
1763 pcbddc->mat_graph->cloc = PETSC_FALSE;
1764 }
1765 ierr = DMDAGetSubdomainCornersIS(dm,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1765,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1766 ierr = MatISGetLocalMat(pc->pmat,&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1766,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1767 ierr = MatGetLocalToGlobalMapping(lA,&l2l,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1767,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1768 ierr = MatISRestoreLocalMat(pc->pmat,&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1768,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1769 lo = (PetscBool)(l2l && corners);
1770 ierr = MPIU_Allreduce(&lo,&gl,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,1770,__func__,"/sandbox/petsc/petsc.master/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),1770,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1771 if (gl) { /* From PETSc's DMDA */
1772 const PetscInt *idx;
1773 PetscInt dof,bs,*idxout,n;
1774
1775 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),1775,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1776 ierr = ISLocalToGlobalMappingGetBlockSize(l2l,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1776,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1777 ierr = ISGetLocalSize(corners,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1777,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1778 ierr = ISGetIndices(corners,&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1778,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1779 if (bs == dof) {
1780 ierr = PetscMalloc1(n,&idxout)PetscMallocA(1,PETSC_FALSE,1780,__func__,"/sandbox/petsc/petsc.master/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),1780,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1781 ierr = ISLocalToGlobalMappingApplyBlock(l2l,n,idx,idxout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1781,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1782 } else { /* the original DMDA local-to-local map have been modified */
1783 PetscInt i,d;
1784
1785 ierr = PetscMalloc1(dof*n,&idxout)PetscMallocA(1,PETSC_FALSE,1785,__func__,"/sandbox/petsc/petsc.master/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),1785,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1786 for (i=0;i<n;i++) for (d=0;d<dof;d++) idxout[dof*i+d] = dof*idx[i]+d;
1787 ierr = ISLocalToGlobalMappingApply(l2l,dof*n,idxout,idxout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1787,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1788
1789 bs = 1;
1790 n *= dof;
1791 }
1792 ierr = ISRestoreIndices(corners,&idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1792,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1793 ierr = DMDARestoreSubdomainCornersIS(dm,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1793,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1794 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),1794,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1795 ierr = PCBDDCAddPrimalVerticesLocalIS(pc,corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1795,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1796 ierr = ISDestroy(&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1796,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1797 pcbddc->corner_selected = PETSC_TRUE;
1798 pcbddc->corner_selection = PETSC_TRUE;
1799 }
1800 if (corners) {
1801 ierr = DMDARestoreSubdomainCornersIS(dm,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1801,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1802 }
1803 }
1804 }
1805 }
1806 if (pcbddc->corner_selection && !pcbddc->mat_graph->cdim) {
1807 DM dm;
1808
1809 ierr = MatGetDM(pc->pmat,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1809,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1810 if (!dm) {
1811 ierr = PCGetDM(pc,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1811,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1812 }
1813 if (dm) { /* this can get very expensive, I need to find a faster alternative */
1814 Vec vcoords;
1815 PetscSection section;
1816 PetscReal *coords;
1817 PetscInt d,cdim,nl,nf,**ctxs;
1818 PetscErrorCode (**funcs)(PetscInt, PetscReal, const PetscReal *, PetscInt, PetscScalar *, void *);
1819
1820 ierr = DMGetCoordinateDim(dm,&cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1820,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1821 ierr = DMGetLocalSection(dm,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1821,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1822 ierr = PetscSectionGetNumFields(section,&nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1822,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1823 ierr = DMCreateGlobalVector(dm,&vcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1823,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1824 ierr = VecGetLocalSize(vcoords,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1824,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1825 ierr = PetscMalloc1(nl*cdim,&coords)PetscMallocA(1,PETSC_FALSE,1825,__func__,"/sandbox/petsc/petsc.master/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),1825,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1826 ierr = PetscMalloc2(nf,&funcs,nf,&ctxs)PetscMallocA(2,PETSC_FALSE,1826,__func__,"/sandbox/petsc/petsc.master/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),1826,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1827 ierr = PetscMalloc1(nf,&ctxs[0])PetscMallocA(1,PETSC_FALSE,1827,__func__,"/sandbox/petsc/petsc.master/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),1827,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1828 for (d=0;d<nf;d++) funcs[d] = func_coords_private;
1829 for (d=1;d<nf;d++) ctxs[d] = ctxs[d-1] + 1;
1830 for (d=0;d<cdim;d++) {
1831 PetscInt i;
1832 const PetscScalar *v;
1833
1834 for (i=0;i<nf;i++) ctxs[i][0] = d;
1835 ierr = DMProjectFunction(dm,0.0,funcs,(void**)ctxs,INSERT_VALUES,vcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1835,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1836 ierr = VecGetArrayRead(vcoords,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1836,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1837 for (i=0;i<nl;i++) coords[i*cdim+d] = PetscRealPart(v[i])(v[i]);
1838 ierr = VecRestoreArrayRead(vcoords,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1838,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1839 }
1840 ierr = VecDestroy(&vcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1840,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1841 ierr = PCSetCoordinates(pc,cdim,nl,coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1841,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1842 ierr = PetscFree(coords)((*PetscTrFree)((void*)(coords),1842,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((coords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1842,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1843 ierr = PetscFree(ctxs[0])((*PetscTrFree)((void*)(ctxs[0]),1843,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ctxs[0]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1843,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1844 ierr = PetscFree2(funcs,ctxs)PetscFreeA(2,1844,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(funcs),&(ctxs))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1844,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1845 }
1846 }
1847 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1848}
1849
1850PetscErrorCode PCBDDCConsistencyCheckIS(PC pc, MPI_Op mop, IS *is)
1851{
1852 Mat_IS *matis = (Mat_IS*)(pc->pmat->data);
1853 PetscErrorCode ierr;
1854 IS nis;
1855 const PetscInt *idxs;
1856 PetscInt i,nd,n = matis->A->rmap->n,*nidxs,nnd;
1857 PetscBool *ld;
1858
1859 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1859; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1860 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)),1860,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Supported are MPI_LAND and MPI_LOR")
;
1861 if (mop == MPI_LAND(MPI_Op)(0x58000005)) {
1862 /* init rootdata with true */
1863 ld = (PetscBool*) matis->sf_rootdata;
1864 for (i=0;i<pc->pmat->rmap->n;i++) ld[i] = PETSC_TRUE;
1865 } else {
1866 ierr = PetscArrayzero(matis->sf_rootdata,pc->pmat->rmap->n)PetscMemzero(matis->sf_rootdata,(pc->pmat->rmap->
n)*sizeof(*(matis->sf_rootdata)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1866,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1867 }
1868 ierr = PetscArrayzero(matis->sf_leafdata,n)PetscMemzero(matis->sf_leafdata,(n)*sizeof(*(matis->sf_leafdata
)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1868,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1869 ierr = ISGetLocalSize(*is,&nd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1869,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1870 ierr = ISGetIndices(*is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1870,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1871 ld = (PetscBool*) matis->sf_leafdata;
1872 for (i=0;i<nd;i++)
1873 if (-1 < idxs[i] && idxs[i] < n)
1874 ld[idxs[i]] = PETSC_TRUE;
1875 ierr = ISRestoreIndices(*is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1875,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1876 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),1876,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1877 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),1877,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1878 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),1878,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1879 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),1879,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1880 if (mop == MPI_LAND(MPI_Op)(0x58000005)) {
1881 ierr = PetscMalloc1(nd,&nidxs)PetscMallocA(1,PETSC_FALSE,1881,__func__,"/sandbox/petsc/petsc.master/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),1881,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1882 } else {
1883 ierr = PetscMalloc1(n,&nidxs)PetscMallocA(1,PETSC_FALSE,1883,__func__,"/sandbox/petsc/petsc.master/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),1883,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1884 }
1885 for (i=0,nnd=0;i<n;i++)
1886 if (ld[i])
1887 nidxs[nnd++] = i;
1888 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)(*is)),nnd,nidxs,PETSC_OWN_POINTER,&nis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1888,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1889 ierr = ISDestroy(is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1889,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1890 *is = nis;
1891 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1892}
1893
1894PetscErrorCode PCBDDCBenignRemoveInterior(PC pc,Vec r,Vec z)
1895{
1896 PC_IS *pcis = (PC_IS*)(pc->data);
1897 PC_BDDC *pcbddc = (PC_BDDC*)(pc->data);
1898 PetscErrorCode ierr;
1899
1900 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1900; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1901 if (!pcbddc->benign_have_null) {
1902 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1903 }
1904 if (pcbddc->ChangeOfBasisMatrix) {
1905 Vec swap;
1906
1907 ierr = MatMultTranspose(pcbddc->ChangeOfBasisMatrix,r,pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1907,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1908 swap = pcbddc->work_change;
1909 pcbddc->work_change = r;
1910 r = swap;
1911 }
1912 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),1912,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1913 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),1913,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1914 ierr = KSPSolve(pcbddc->ksp_D,pcis->vec1_D,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1914,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1915 ierr = KSPCheckSolve(pcbddc->ksp_D,pc,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1915,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1916 ierr = VecSet(z,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1916,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1917 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),1917,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1918 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),1918,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1919 if (pcbddc->ChangeOfBasisMatrix) {
1920 pcbddc->work_change = r;
1921 ierr = VecCopy(z,pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1921,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1922 ierr = MatMult(pcbddc->ChangeOfBasisMatrix,pcbddc->work_change,z);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1922,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1923 }
1924 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1925}
1926
1927PetscErrorCode PCBDDCBenignMatMult_Private_Private(Mat A, Vec x, Vec y, PetscBool transpose)
1928{
1929 PCBDDCBenignMatMult_ctx ctx;
1930 PetscErrorCode ierr;
1931 PetscBool apply_right,apply_left,reset_x;
1932
1933 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 1933; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1934 ierr = MatShellGetContext(A,&ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1934,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1935 if (transpose) {
1936 apply_right = ctx->apply_left;
1937 apply_left = ctx->apply_right;
1938 } else {
1939 apply_right = ctx->apply_right;
1940 apply_left = ctx->apply_left;
1941 }
1942 reset_x = PETSC_FALSE;
1943 if (apply_right) {
1944 const PetscScalar *ax;
1945 PetscInt nl,i;
1946
1947 ierr = VecGetLocalSize(x,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1947,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1948 ierr = VecGetArrayRead(x,&ax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1948,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1949 ierr = PetscArraycpy(ctx->work,ax,nl)((sizeof(*(ctx->work)) != sizeof(*(ax))) || PetscMemcpy(ctx
->work,ax,(nl)*sizeof(*(ctx->work))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1949,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1950 ierr = VecRestoreArrayRead(x,&ax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1950,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1951 for (i=0;i<ctx->benign_n;i++) {
1952 PetscScalar sum,val;
1953 const PetscInt *idxs;
1954 PetscInt nz,j;
1955 ierr = ISGetLocalSize(ctx->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1955,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1956 ierr = ISGetIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1956,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1957 sum = 0.;
1958 if (ctx->apply_p0) {
1959 val = ctx->work[idxs[nz-1]];
1960 for (j=0;j<nz-1;j++) {
1961 sum += ctx->work[idxs[j]];
1962 ctx->work[idxs[j]] += val;
1963 }
1964 } else {
1965 for (j=0;j<nz-1;j++) {
1966 sum += ctx->work[idxs[j]];
1967 }
1968 }
1969 ctx->work[idxs[nz-1]] -= sum;
1970 ierr = ISRestoreIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1970,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1971 }
1972 ierr = VecPlaceArray(x,ctx->work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1972,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1973 reset_x = PETSC_TRUE;
1974 }
1975 if (transpose) {
1976 ierr = MatMultTranspose(ctx->A,x,y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1976,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1977 } else {
1978 ierr = MatMult(ctx->A,x,y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1978,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1979 }
1980 if (reset_x) {
1981 ierr = VecResetArray(x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1981,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1982 }
1983 if (apply_left) {
1984 PetscScalar *ay;
1985 PetscInt i;
1986
1987 ierr = VecGetArray(y,&ay);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1987,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1988 for (i=0;i<ctx->benign_n;i++) {
1989 PetscScalar sum,val;
1990 const PetscInt *idxs;
1991 PetscInt nz,j;
1992 ierr = ISGetLocalSize(ctx->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1992,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1993 ierr = ISGetIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1993,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1994 val = -ay[idxs[nz-1]];
1995 if (ctx->apply_p0) {
1996 sum = 0.;
1997 for (j=0;j<nz-1;j++) {
1998 sum += ay[idxs[j]];
1999 ay[idxs[j]] += val;
2000 }
2001 ay[idxs[nz-1]] += sum;
2002 } else {
2003 for (j=0;j<nz-1;j++) {
2004 ay[idxs[j]] += val;
2005 }
2006 ay[idxs[nz-1]] = 0.;
2007 }
2008 ierr = ISRestoreIndices(ctx->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2008,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2009 }
2010 ierr = VecRestoreArray(y,&ay);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2010,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2011 }
2012 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2013}
2014
2015PetscErrorCode PCBDDCBenignMatMultTranspose_Private(Mat A, Vec x, Vec y)
2016{
2017 PetscErrorCode ierr;
2018
2019 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2019; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2020 ierr = PCBDDCBenignMatMult_Private_Private(A,x,y,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2020,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2021 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2022}
2023
2024PetscErrorCode PCBDDCBenignMatMult_Private(Mat A, Vec x, Vec y)
2025{
2026 PetscErrorCode ierr;
2027
2028 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2028; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2029 ierr = PCBDDCBenignMatMult_Private_Private(A,x,y,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2029,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2030 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2031}
2032
2033PetscErrorCode PCBDDCBenignShellMat(PC pc, PetscBool restore)
2034{
2035 PC_IS *pcis = (PC_IS*)pc->data;
2036 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
2037 PCBDDCBenignMatMult_ctx ctx;
2038 PetscErrorCode ierr;
2039
2040 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2040; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2041 if (!restore) {
2042 Mat A_IB,A_BI;
2043 PetscScalar *work;
2044 PCBDDCReuseSolvers reuse = pcbddc->sub_schurs ? pcbddc->sub_schurs->reuse_solver : NULL((void*)0);
2045
2046 if (pcbddc->benign_original_mat) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Benign original mat has not been restored")return PetscError(((MPI_Comm)0x44000001),2046,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Benign original mat has not been restored"
)
;
2047 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)
;
2048 ierr = PetscMalloc1(pcis->n,&work)PetscMallocA(1,PETSC_FALSE,2048,__func__,"/sandbox/petsc/petsc.master/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),2048,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2049 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2049,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2050 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),2050,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2051 ierr = MatSetType(A_IB,MATSHELL"shell");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2051,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2052 ierr = MatShellSetOperation(A_IB,MATOP_MULT,(void (*)(void))PCBDDCBenignMatMult_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2052,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2053 ierr = MatShellSetOperation(A_IB,MATOP_MULT_TRANSPOSE,(void (*)(void))PCBDDCBenignMatMultTranspose_Private);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2053,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2054 ierr = PetscNew(&ctx)PetscMallocA(1,PETSC_TRUE,2054,__func__,"/sandbox/petsc/petsc.master/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),2054,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2055 ierr = MatShellSetContext(A_IB,ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2055,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2056 ctx->apply_left = PETSC_TRUE;
2057 ctx->apply_right = PETSC_FALSE;
2058 ctx->apply_p0 = PETSC_FALSE;
2059 ctx->benign_n = pcbddc->benign_n;
2060 if (reuse) {
2061 ctx->benign_zerodiag_subs = reuse->benign_zerodiag_subs;
2062 ctx->free = PETSC_FALSE;
2063 } else { /* TODO: could be optimized for successive solves */
2064 ISLocalToGlobalMapping N_to_D;
2065 PetscInt i;
2066
2067 ierr = ISLocalToGlobalMappingCreateIS(pcis->is_I_local,&N_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2067,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2068 ierr = PetscMalloc1(pcbddc->benign_n,&ctx->benign_zerodiag_subs)PetscMallocA(1,PETSC_FALSE,2068,__func__,"/sandbox/petsc/petsc.master/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),2068,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2069 for (i=0;i<pcbddc->benign_n;i++) {
2070 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),2070,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2071 }
2072 ierr = ISLocalToGlobalMappingDestroy(&N_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2072,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2073 ctx->free = PETSC_TRUE;
2074 }
2075 ctx->A = pcis->A_IB;
2076 ctx->work = work;
2077 ierr = MatSetUp(A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2077,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2078 ierr = MatAssemblyBegin(A_IB,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2078,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2079 ierr = MatAssemblyEnd(A_IB,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2079,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2080 pcis->A_IB = A_IB;
2081
2082 /* A_BI as A_IB^T */
2083 ierr = MatCreateTranspose(A_IB,&A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2083,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2084 pcbddc->benign_original_mat = pcis->A_BI;
2085 pcis->A_BI = A_BI;
2086 } else {
2087 if (!pcbddc->benign_original_mat) {
2088 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2089 }
2090 ierr = MatShellGetContext(pcis->A_IB,&ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2090,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2091 ierr = MatDestroy(&pcis->A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2091,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2092 pcis->A_IB = ctx->A;
2093 ctx->A = NULL((void*)0);
2094 ierr = MatDestroy(&pcis->A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2094,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2095 pcis->A_BI = pcbddc->benign_original_mat;
2096 pcbddc->benign_original_mat = NULL((void*)0);
2097 if (ctx->free) {
2098 PetscInt i;
2099 for (i=0;i<ctx->benign_n;i++) {
2100 ierr = ISDestroy(&ctx->benign_zerodiag_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2100,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2101 }
2102 ierr = PetscFree(ctx->benign_zerodiag_subs)((*PetscTrFree)((void*)(ctx->benign_zerodiag_subs),2102,__func__
,"/sandbox/petsc/petsc.master/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),2102,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2103 }
2104 ierr = PetscFree(ctx->work)((*PetscTrFree)((void*)(ctx->work),2104,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ctx->work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2104,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2105 ierr = PetscFree(ctx)((*PetscTrFree)((void*)(ctx),2105,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ctx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2105,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2106 }
2107 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2108}
2109
2110/* used just in bddc debug mode */
2111PetscErrorCode PCBDDCBenignProject(PC pc, IS is1, IS is2, Mat *B)
2112{
2113 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
2114 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
2115 Mat An;
2116 PetscErrorCode ierr;
2117
2118 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2118; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2119 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),2119,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2120 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),2120,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2121 if (is1) {
2122 ierr = MatCreateSubMatrix(An,is1,is2,MAT_INITIAL_MATRIX,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2122,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2123 ierr = MatDestroy(&An);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2123,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2124 } else {
2125 *B = An;
2126 }
2127 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2128}
2129
2130/* TODO: add reuse flag */
2131PetscErrorCode MatSeqAIJCompress(Mat A, Mat *B)
2132{
2133 Mat Bt;
2134 PetscScalar *a,*bdata;
2135 const PetscInt *ii,*ij;
2136 PetscInt m,n,i,nnz,*bii,*bij;
2137 PetscBool flg_row;
2138 PetscErrorCode ierr;
2139
2140 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2140; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2141 ierr = MatGetSize(A,&n,&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2141,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2142 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),2142,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2143 ierr = MatSeqAIJGetArray(A,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2143,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2144 nnz = n;
2145 for (i=0;i<ii[n];i++) {
2146 if (PetscLikely(PetscAbsScalar(a[i]) > PETSC_SMALL)__builtin_expect(!!(fabs(a[i]) > 1.e-10),1)) nnz++;
2147 }
2148 ierr = PetscMalloc1(n+1,&bii)PetscMallocA(1,PETSC_FALSE,2148,__func__,"/sandbox/petsc/petsc.master/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),2148,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2149 ierr = PetscMalloc1(nnz,&bij)PetscMallocA(1,PETSC_FALSE,2149,__func__,"/sandbox/petsc/petsc.master/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),2149,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2150 ierr = PetscMalloc1(nnz,&bdata)PetscMallocA(1,PETSC_FALSE,2150,__func__,"/sandbox/petsc/petsc.master/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),2150,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2151 nnz = 0;
2152 bii[0] = 0;
2153 for (i=0;i<n;i++) {
2154 PetscInt j;
2155 for (j=ii[i];j<ii[i+1];j++) {
2156 PetscScalar entry = a[j];
2157 if (PetscLikely(PetscAbsScalar(entry) > PETSC_SMALL)__builtin_expect(!!(fabs(entry) > 1.e-10),1) || (n == m && ij[j] == i)) {
2158 bij[nnz] = ij[j];
2159 bdata[nnz] = entry;
2160 nnz++;
2161 }
2162 }
2163 bii[i+1] = nnz;
2164 }
2165 ierr = MatSeqAIJRestoreArray(A,&a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2165,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2166 ierr = MatCreateSeqAIJWithArrays(PetscObjectComm((PetscObject)A),n,m,bii,bij,bdata,&Bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2166,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2167 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),2167,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2168 {
2169 Mat_SeqAIJ *b = (Mat_SeqAIJ*)(Bt->data);
2170 b->free_a = PETSC_TRUE;
2171 b->free_ij = PETSC_TRUE;
2172 }
2173 if (*B == A) {
2174 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2174,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2175 }
2176 *B = Bt;
2177 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2178}
2179
2180PetscErrorCode PCBDDCDetectDisconnectedComponents(PC pc, PetscBool filter, PetscInt *ncc, IS* cc[], IS* primalv)
2181{
2182 Mat B = NULL((void*)0);
2183 DM dm;
2184 IS is_dummy,*cc_n;
2185 ISLocalToGlobalMapping l2gmap_dummy;
2186 PCBDDCGraph graph;
2187 PetscInt *xadj_filtered = NULL((void*)0),*adjncy_filtered = NULL((void*)0);
2188 PetscInt i,n;
2189 PetscInt *xadj,*adjncy;
2190 PetscBool isplex = PETSC_FALSE;
2191 PetscErrorCode ierr;
2192
2193 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2193; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2194 if (ncc) *ncc = 0;
2195 if (cc) *cc = NULL((void*)0);
2196 if (primalv) *primalv = NULL((void*)0);
2197 ierr = PCBDDCGraphCreate(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2197,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2198 ierr = MatGetDM(pc->pmat,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2198,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2199 if (!dm) {
2200 ierr = PCGetDM(pc,&dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2200,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2201 }
2202 if (dm) {
2203 ierr = PetscObjectTypeCompare((PetscObject)dm,DMPLEX"plex",&isplex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2203,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2204 }
2205 if (filter) isplex = PETSC_FALSE;
2206
2207 if (isplex) { /* this code has been modified from plexpartition.c */
2208 PetscInt p, pStart, pEnd, a, adjSize, idx, size, nroots;
2209 PetscInt *adj = NULL((void*)0);
2210 IS cellNumbering;
2211 const PetscInt *cellNum;
2212 PetscBool useCone, useClosure;
2213 PetscSection section;
2214 PetscSegBuffer adjBuffer;
2215 PetscSF sfPoint;
2216 PetscErrorCode ierr;
2217
2218 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2218; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2219 ierr = DMPlexGetHeightStratum(dm, 0, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2219,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2220 ierr = DMGetPointSF(dm, &sfPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2220,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2221 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),2221,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2222 /* Build adjacency graph via a section/segbuffer */
2223 ierr = PetscSectionCreate(PetscObjectComm((PetscObject) dm), &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2223,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2224 ierr = PetscSectionSetChart(section, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2224,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2225 ierr = PetscSegBufferCreate(sizeof(PetscInt),1000,&adjBuffer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2225,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2226 /* Always use FVM adjacency to create partitioner graph */
2227 ierr = DMGetBasicAdjacency(dm, &useCone, &useClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2227,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2228 ierr = DMSetBasicAdjacency(dm, PETSC_TRUE, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2228,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2229 ierr = DMPlexGetCellNumbering(dm, &cellNumbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2229,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2230 ierr = ISGetIndices(cellNumbering, &cellNum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2230,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2231 for (n = 0, p = pStart; p < pEnd; p++) {
2232 /* Skip non-owned cells in parallel (ParMetis expects no overlap) */
2233 if (nroots > 0) {if (cellNum[p] < 0) continue;}
2234 adjSize = PETSC_DETERMINE-1;
2235 ierr = DMPlexGetAdjacency(dm, p, &adjSize, &adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2235,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2236 for (a = 0; a < adjSize; ++a) {
2237 const PetscInt point = adj[a];
2238 if (pStart <= point && point < pEnd) {
2239 PetscInt *PETSC_RESTRICT__restrict pBuf;
2240 ierr = PetscSectionAddDof(section, p, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2240,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2241 ierr = PetscSegBufferGetInts(adjBuffer, 1, &pBuf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2241,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2242 *pBuf = point;
2243 }
2244 }
2245 n++;
2246 }
2247 ierr = DMSetBasicAdjacency(dm, useCone, useClosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2247,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2248 /* Derive CSR graph from section/segbuffer */
2249 ierr = PetscSectionSetUp(section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2249,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2250 ierr = PetscSectionGetStorageSize(section, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2251 ierr = PetscMalloc1(n+1, &xadj)PetscMallocA(1,PETSC_FALSE,2251,__func__,"/sandbox/petsc/petsc.master/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),2251,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2252 for (idx = 0, p = pStart; p < pEnd; p++) {
2253 if (nroots > 0) {if (cellNum[p] < 0) continue;}
2254 ierr = PetscSectionGetOffset(section, p, &(xadj[idx++]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2254,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2255 }
2256 xadj[n] = size;
2257 ierr = PetscSegBufferExtractAlloc(adjBuffer, &adjncy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2257,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2258 /* Clean up */
2259 ierr = PetscSegBufferDestroy(&adjBuffer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2259,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2260 ierr = PetscSectionDestroy(&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2260,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2261 ierr = PetscFree(adj)((*PetscTrFree)((void*)(adj),2261,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2261,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2262 graph->xadj = xadj;
2263 graph->adjncy = adjncy;
2264 } else {
2265 Mat A;
2266 PetscBool isseqaij, flg_row;
2267
2268 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2268,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2269 if (!A->rmap->N || !A->cmap->N) {
2270 ierr = PCBDDCGraphDestroy(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2270,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2271 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2272 }
2273 ierr = PetscObjectTypeCompare((PetscObject)A,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2273,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2274 if (!isseqaij && filter) {
2275 PetscBool isseqdense;
2276
2277 ierr = PetscObjectTypeCompare((PetscObject)A,MATSEQDENSE"seqdense",&isseqdense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2277,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2278 if (!isseqdense) {
2279 ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2279,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2280 } else { /* TODO: rectangular case and LDA */
2281 PetscScalar *array;
2282 PetscReal chop=1.e-6;
2283
2284 ierr = MatDuplicate(A,MAT_COPY_VALUES,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2284,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2285 ierr = MatDenseGetArray(B,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2285,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2286 ierr = MatGetSize(B,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2286,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2287 for (i=0;i<n;i++) {
2288 PetscInt j;
2289 for (j=i+1;j<n;j++) {
2290 PetscReal thresh = chop*(PetscAbsScalar(array[i*(n+1)])fabs(array[i*(n+1)])+PetscAbsScalar(array[j*(n+1)])fabs(array[j*(n+1)]));
2291 if (PetscAbsScalar(array[i*n+j])fabs(array[i*n+j]) < thresh) array[i*n+j] = 0.;
2292 if (PetscAbsScalar(array[j*n+i])fabs(array[j*n+i]) < thresh) array[j*n+i] = 0.;
2293 }
2294 }
2295 ierr = MatDenseRestoreArray(B,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2295,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2296 ierr = MatConvert(B,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2296,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2297 }
2298 } else {
2299 ierr = PetscObjectReference((PetscObject)A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2299,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2300 B = A;
2301 }
2302 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),2302,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2303
2304 /* if filter is true, then removes entries lower than PETSC_SMALL in magnitude */
2305 if (filter) {
2306 PetscScalar *data;
2307 PetscInt j,cum;
2308
2309 ierr = PetscCalloc2(n+1,&xadj_filtered,xadj[n],&adjncy_filtered)PetscMallocA(2,PETSC_TRUE,2309,__func__,"/sandbox/petsc/petsc.master/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),2309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2310 ierr = MatSeqAIJGetArray(B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2310,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2311 cum = 0;
2312 for (i=0;i<n;i++) {
2313 PetscInt t;
2314
2315 for (j=xadj[i];j<xadj[i+1];j++) {
2316 if (PetscUnlikely(PetscAbsScalar(data[j]) < PETSC_SMALL)__builtin_expect(!!(fabs(data[j]) < 1.e-10),0)) {
2317 continue;
2318 }
2319 adjncy_filtered[cum+xadj_filtered[i]++] = adjncy[j];
2320 }
2321 t = xadj_filtered[i];
2322 xadj_filtered[i] = cum;
2323 cum += t;
2324 }
2325 ierr = MatSeqAIJRestoreArray(B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2325,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2326 graph->xadj = xadj_filtered;
2327 graph->adjncy = adjncy_filtered;
2328 } else {
2329 graph->xadj = xadj;
2330 graph->adjncy = adjncy;
2331 }
2332 }
2333 /* compute local connected components using PCBDDCGraph */
2334 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),2334,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2335 ierr = ISLocalToGlobalMappingCreateIS(is_dummy,&l2gmap_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2335,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2336 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2336,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2337 ierr = PCBDDCGraphInit(graph,l2gmap_dummy,n,PETSC_MAX_INT2147483647);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2337,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2338 ierr = ISLocalToGlobalMappingDestroy(&l2gmap_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2338,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2339 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),2339,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2340 ierr = PCBDDCGraphComputeConnectedComponents(graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2340,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2341
2342 /* partial clean up */
2343 ierr = PetscFree2(xadj_filtered,adjncy_filtered)PetscFreeA(2,2343,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(xadj_filtered),&(adjncy_filtered))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2343,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2344 if (B) {
2345 PetscBool flg_row;
2346 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),2346,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2347 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2347,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2348 }
2349 if (isplex) {
2350 ierr = PetscFree(xadj)((*PetscTrFree)((void*)(xadj),2350,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((xadj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2350,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2351 ierr = PetscFree(adjncy)((*PetscTrFree)((void*)(adjncy),2351,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2351,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2352 }
2353
2354 /* get back data */
2355 if (isplex) {
2356 if (ncc) *ncc = graph->ncc;
2357 if (cc || primalv) {
2358 Mat A;
2359 PetscBT btv,btvt;
2360 PetscSection subSection;
2361 PetscInt *ids,cum,cump,*cids,*pids;
2362
2363 ierr = DMPlexGetSubdomainSection(dm,&subSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2363,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2364 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2364,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2365 ierr = PetscMalloc3(A->rmap->n,&ids,graph->ncc+1,&cids,A->rmap->n,&pids)PetscMallocA(3,PETSC_FALSE,2365,__func__,"/sandbox/petsc/petsc.master/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),2365,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2366 ierr = PetscBTCreate(A->rmap->n,&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2366,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2367 ierr = PetscBTCreate(A->rmap->n,&btvt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2367,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2368
2369 cids[0] = 0;
2370 for (i = 0, cump = 0, cum = 0; i < graph->ncc; i++) {
2371 PetscInt j;
2372
2373 ierr = PetscBTMemzero(A->rmap->n,btvt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2373,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2374 for (j = graph->cptr[i]; j < graph->cptr[i+1]; j++) {
2375 PetscInt k, size, *closure = NULL((void*)0), cell = graph->queue[j];
2376
2377 ierr = DMPlexGetTransitiveClosure(dm,cell,PETSC_TRUE,&size,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2377,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2378 for (k = 0; k < 2*size; k += 2) {
2379 PetscInt s, pp, p = closure[k], off, dof, cdof;
2380
2381 ierr = PetscSectionGetConstraintDof(subSection,p,&cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2381,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2382 ierr = PetscSectionGetOffset(subSection,p,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2382,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2383 ierr = PetscSectionGetDof(subSection,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2383,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2384 for (s = 0; s < dof-cdof; s++) {
2385 if (PetscBTLookupSet(btvt,off+s)) continue;
2386 if (!PetscBTLookup(btv,off+s)) {
2387 ids[cum++] = off+s;
2388 } else { /* cross-vertex */
2389 pids[cump++] = off+s;
2390 }
2391 }
2392 ierr = DMPlexGetTreeParent(dm,p,&pp,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2392,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2393 if (pp != p) {
2394 ierr = PetscSectionGetConstraintDof(subSection,pp,&cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2394,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2395 ierr = PetscSectionGetOffset(subSection,pp,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2395,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2396 ierr = PetscSectionGetDof(subSection,pp,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2396,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2397 for (s = 0; s < dof-cdof; s++) {
2398 if (PetscBTLookupSet(btvt,off+s)) continue;
2399 if (!PetscBTLookup(btv,off+s)) {
2400 ids[cum++] = off+s;
2401 } else { /* cross-vertex */
2402 pids[cump++] = off+s;
2403 }
2404 }
2405 }
2406 }
2407 ierr = DMPlexRestoreTransitiveClosure(dm,cell,PETSC_TRUE,&size,&closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2407,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2408 }
2409 cids[i+1] = cum;
2410 /* mark dofs as already assigned */
2411 for (j = cids[i]; j < cids[i+1]; j++) {
2412 ierr = PetscBTSet(btv,ids[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2412,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2413 }
2414 }
2415 if (cc) {
2416 ierr = PetscMalloc1(graph->ncc,&cc_n)PetscMallocA(1,PETSC_FALSE,2416,__func__,"/sandbox/petsc/petsc.master/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),2416,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2417 for (i = 0; i < graph->ncc; i++) {
2418 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),2418,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2419 }
2420 *cc = cc_n;
2421 }
2422 if (primalv) {
2423 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),cump,pids,PETSC_COPY_VALUES,primalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2423,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2424 }
2425 ierr = PetscFree3(ids,cids,pids)PetscFreeA(3,2425,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(ids),&(cids),&(pids))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2425,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2426 ierr = PetscBTDestroy(&btv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2426,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2427 ierr = PetscBTDestroy(&btvt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2427,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2428 }
2429 } else {
2430 if (ncc) *ncc = graph->ncc;
2431 if (cc) {
2432 ierr = PetscMalloc1(graph->ncc,&cc_n)PetscMallocA(1,PETSC_FALSE,2432,__func__,"/sandbox/petsc/petsc.master/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),2432,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2433 for (i=0;i<graph->ncc;i++) {
2434 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),2434,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2435 }
2436 *cc = cc_n;
2437 }
2438 }
2439 /* clean up graph */
2440 graph->xadj = 0;
2441 graph->adjncy = 0;
2442 ierr = PCBDDCGraphDestroy(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2442,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2443 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2444}
2445
2446PetscErrorCode PCBDDCBenignCheck(PC pc, IS zerodiag)
2447{
2448 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
2449 PC_IS* pcis = (PC_IS*)(pc->data);
2450 IS dirIS = NULL((void*)0);
2451 PetscInt i;
2452 PetscErrorCode ierr;
2453
2454 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2454; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2455 ierr = PCBDDCGraphGetDirichletDofs(pcbddc->mat_graph,&dirIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2455,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2456 if (zerodiag) {
2457 Mat A;
2458 Vec vec3_N;
2459 PetscScalar *vals;
2460 const PetscInt *idxs;
2461 PetscInt nz,*count;
2462
2463 /* p0 */
2464 ierr = VecSet(pcis->vec1_N,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2464,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2465 ierr = PetscMalloc1(pcis->n,&vals)PetscMallocA(1,PETSC_FALSE,2465,__func__,"/sandbox/petsc/petsc.master/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),2465,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2466 ierr = ISGetLocalSize(zerodiag,&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2466,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2467 ierr = ISGetIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2467,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2468 for (i=0;i<nz;i++) vals[i] = 1.;
2469 ierr = VecSetValues(pcis->vec1_N,nz,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2469,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2470 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2470,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2471 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2471,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2472 /* v_I */
2473 ierr = VecSetRandom(pcis->vec2_N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2473,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2474 for (i=0;i<nz;i++) vals[i] = 0.;
2475 ierr = VecSetValues(pcis->vec2_N,nz,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2475,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2476 ierr = ISRestoreIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2476,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2477 ierr = ISGetIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2477,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2478 for (i=0;i<pcis->n_B;i++) vals[i] = 0.;
2479 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),2479,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2480 ierr = ISRestoreIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2480,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2481 if (dirIS) {
2482 PetscInt n;
2483
2484 ierr = ISGetLocalSize(dirIS,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2484,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2485 ierr = ISGetIndices(dirIS,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2485,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2486 for (i=0;i<n;i++) vals[i] = 0.;
2487 ierr = VecSetValues(pcis->vec2_N,n,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2487,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2488 ierr = ISRestoreIndices(dirIS,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2488,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2489 }
2490 ierr = VecAssemblyBegin(pcis->vec2_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2490,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2491 ierr = VecAssemblyEnd(pcis->vec2_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2491,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2492 ierr = VecDuplicate(pcis->vec1_N,&vec3_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2492,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2493 ierr = VecSet(vec3_N,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2493,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2494 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2494,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2495 ierr = MatMult(A,pcis->vec1_N,vec3_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2495,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2496 ierr = VecDot(vec3_N,pcis->vec2_N,&vals[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2496,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2497 if (PetscAbsScalar(vals[0])fabs(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),2497,__func__,"/sandbox/petsc/petsc.master/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.)"
,fabs(vals[0]))
;
2498 ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),2498,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2498,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2499 ierr = VecDestroy(&vec3_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2499,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2500
2501 /* there should not be any pressure dofs lying on the interface */
2502 ierr = PetscCalloc1(pcis->n,&count)PetscMallocA(1,PETSC_TRUE,2502,__func__,"/sandbox/petsc/petsc.master/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),2502,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2503 ierr = ISGetIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2503,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2504 for (i=0;i<pcis->n_B;i++) count[idxs[i]]++;
2505 ierr = ISRestoreIndices(pcis->is_B_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2505,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2506 ierr = ISGetIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2506,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2507 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),2507,__func__,"/sandbox/petsc/petsc.master/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])
;
2508 ierr = ISRestoreIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2508,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2509 ierr = PetscFree(count)((*PetscTrFree)((void*)(count),2509,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((count) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2509,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2510 }
2511 ierr = ISDestroy(&dirIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2511,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2512
2513 /* check PCBDDCBenignGetOrSetP0 */
2514 ierr = VecSetRandom(pcis->vec1_global,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2514,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2515 for (i=0;i<pcbddc->benign_n;i++) pcbddc->benign_p0[i] = -PetscGlobalRank-i;
2516 ierr = PCBDDCBenignGetOrSetP0(pc,pcis->vec1_global,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2516,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2517 for (i=0;i<pcbddc->benign_n;i++) pcbddc->benign_p0[i] = 1;
2518 ierr = PCBDDCBenignGetOrSetP0(pc,pcis->vec1_global,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2518,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2519 for (i=0;i<pcbddc->benign_n;i++) {
2520 PetscInt val = PetscRealPart(pcbddc->benign_p0[i])(pcbddc->benign_p0[i]);
2521 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),2521,__func__,"/sandbox/petsc/petsc.master/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)
;
2522 }
2523 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2524}
2525
2526PetscErrorCode PCBDDCBenignDetectSaddlePoint(PC pc, PetscBool reuse, IS *zerodiaglocal)
2527{
2528 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
2529 IS pressures = NULL((void*)0),zerodiag = NULL((void*)0),*bzerodiag = NULL((void*)0),zerodiag_save,*zerodiag_subs;
2530 PetscInt nz,n,benign_n,bsp = 1;
2531 PetscInt *interior_dofs,n_interior_dofs,nneu;
2532 PetscBool sorted,have_null,has_null_pressures,recompute_zerodiag,checkb;
2533 PetscErrorCode ierr;
2534
2535 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2535; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2536 if (reuse) goto project_b0;
1
Assuming 'reuse' is 0
2
Taking false branch
2537 ierr = PetscSFDestroy(&pcbddc->benign_sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2537,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2538 ierr = MatDestroy(&pcbddc->benign_B0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2538,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2539 for (n=0;n<pcbddc->benign_n;n++) {
3
Assuming the condition is false
4
Loop condition is false. Execution continues on line 2542
2540 ierr = ISDestroy(&pcbddc->benign_zerodiag_subs[n]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2540,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2541 }
2542 ierr = PetscFree(pcbddc->benign_zerodiag_subs)((*PetscTrFree)((void*)(pcbddc->benign_zerodiag_subs),2542
,__func__,"/sandbox/petsc/petsc.master/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),2542,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2543 has_null_pressures = PETSC_TRUE;
2544 have_null = PETSC_TRUE;
2545 /* if a local information on dofs is present, gets pressure dofs from command line (uses the last field is not provided)
2546 Without local information, it uses only the zerodiagonal dofs (ok if the pressure block is all zero and it is a scalar field)
2547 Checks if all the pressure dofs in each subdomain have a zero diagonal
2548 If not, a change of basis on pressures is not needed
2549 since the local Schur complements are already SPD
2550 */
2551 if (pcbddc->n_ISForDofsLocal) {
5
Assuming the condition is false
6
Taking false branch
2552 IS iP = NULL((void*)0);
2553 PetscInt p,*pp;
2554 PetscBool flg;
2555
2556 ierr = PetscMalloc1(pcbddc->n_ISForDofsLocal,&pp)PetscMallocA(1,PETSC_FALSE,2556,__func__,"/sandbox/petsc/petsc.master/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),2556,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2557 n = pcbddc->n_ISForDofsLocal;
2558 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),2558,__func__,"/sandbox/petsc/petsc.master/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),2558,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2559 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),2559,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2560 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2560,__func__,"/sandbox/petsc/petsc.master/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),2560,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2561 if (!flg) {
2562 n = 1;
2563 pp[0] = pcbddc->n_ISForDofsLocal-1;
2564 }
2565
2566 bsp = 0;
2567 for (p=0;p<n;p++) {
2568 PetscInt bs;
2569
2570 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),2570,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Invalid field id for pressures %D",pp
[p])
;
2571 ierr = ISGetBlockSize(pcbddc->ISForDofsLocal[pp[p]],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2571,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2572 bsp += bs;
2573 }
2574 ierr = PetscMalloc1(bsp,&bzerodiag)PetscMallocA(1,PETSC_FALSE,2574,__func__,"/sandbox/petsc/petsc.master/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),2574,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2575 bsp = 0;
2576 for (p=0;p<n;p++) {
2577 const PetscInt *idxs;
2578 PetscInt b,bs,npl,*bidxs;
2579
2580 ierr = ISGetBlockSize(pcbddc->ISForDofsLocal[pp[p]],&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2580,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2581 ierr = ISGetLocalSize(pcbddc->ISForDofsLocal[pp[p]],&npl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2581,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2582 ierr = ISGetIndices(pcbddc->ISForDofsLocal[pp[p]],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2582,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2583 ierr = PetscMalloc1(npl/bs,&bidxs)PetscMallocA(1,PETSC_FALSE,2583,__func__,"/sandbox/petsc/petsc.master/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),2583,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2584 for (b=0;b<bs;b++) {
2585 PetscInt i;
2586
2587 for (i=0;i<npl/bs;i++) bidxs[i] = idxs[bs*i+b];
2588 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),2588,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2589 bsp++;
2590 }
2591 ierr = PetscFree(bidxs)((*PetscTrFree)((void*)(bidxs),2591,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((bidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2591,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2592 ierr = ISRestoreIndices(pcbddc->ISForDofsLocal[pp[p]],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2592,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2593 }
2594 ierr = ISConcatenate(PETSC_COMM_SELF((MPI_Comm)0x44000001),bsp,bzerodiag,&pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2594,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2595
2596 /* remove zeroed out pressures if we are setting up a BDDC solver for a saddle-point FETI-DP */
2597 ierr = PetscObjectQuery((PetscObject)pc,"__KSPFETIDP_lP",(PetscObject*)&iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2597,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2598 if (iP) {
2599 IS newpressures;
2600
2601 ierr = ISDifference(pressures,iP,&newpressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2601,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2602 ierr = ISDestroy(&pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2602,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2603 pressures = newpressures;
2604 }
2605 ierr = ISSorted(pressures,&sorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2605,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2606 if (!sorted) {
2607 ierr = ISSort(pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2607,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2608 }
2609 ierr = PetscFree(pp)((*PetscTrFree)((void*)(pp),2609,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2609,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2610 }
2611
2612 /* pcis has not been setup yet, so get the local size from the subdomain matrix */
2613 ierr = MatGetLocalSize(pcbddc->local_mat,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2613,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2614 if (!n) pcbddc->benign_change_explicit = PETSC_TRUE;
7
Assuming 'n' is not equal to 0
8
Taking false branch
2615 ierr = MatFindZeroDiagonals(pcbddc->local_mat,&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2615,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2616 ierr = ISSorted(zerodiag,&sorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2616,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2617 if (!sorted) {
9
Assuming 'sorted' is not equal to 0
10
Taking false branch
2618 ierr = ISSort(zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2618,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2619 }
2620 ierr = PetscObjectReference((PetscObject)zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2620,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2621 zerodiag_save = zerodiag;
2622 ierr = ISGetLocalSize(zerodiag,&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2622,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2623 if (!nz) {
11
Assuming 'nz' is not equal to 0
12
Taking false branch
2624 if (n) have_null = PETSC_FALSE;
2625 has_null_pressures = PETSC_FALSE;
2626 ierr = ISDestroy(&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2626,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2627 }
2628 recompute_zerodiag = PETSC_FALSE;
2629
2630 /* in case disconnected subdomains info is present, split the pressures accordingly (otherwise the benign trick could fail) */
2631 zerodiag_subs = NULL((void*)0);
2632 benign_n = 0;
2633 n_interior_dofs = 0;
2634 interior_dofs = NULL((void*)0);
2635 nneu = 0;
2636 if (pcbddc->NeumannBoundariesLocal) {
13
Assuming the condition is false
14
Taking false branch
2637 ierr = ISGetLocalSize(pcbddc->NeumannBoundariesLocal,&nneu);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2637,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2638 }
2639 checkb = (PetscBool)(!pcbddc->NeumannBoundariesLocal || pcbddc->current_level);
2640 if (checkb) { /* need to compute interior nodes */
15
Taking true branch
2641 PetscInt n,i,j;
2642 PetscInt n_neigh,*neigh,*n_shared,**shared;
2643 PetscInt *iwork;
2644
2645 ierr = ISLocalToGlobalMappingGetSize(pc->pmat->rmap->mapping,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2645,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2646 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),2646,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2647 ierr = PetscCalloc1(n,&iwork)PetscMallocA(1,PETSC_TRUE,2647,__func__,"/sandbox/petsc/petsc.master/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),2647,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2648 ierr = PetscMalloc1(n,&interior_dofs)PetscMallocA(1,PETSC_FALSE,2648,__func__,"/sandbox/petsc/petsc.master/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),2648,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2649 for (i=1;i<n_neigh;i++)
16
Assuming 'i' is >= 'n_neigh'
17
Loop condition is false. Execution continues on line 2652
2650 for (j=0;j<n_shared[i];j++)
2651 iwork[shared[i][j]] += 1;
2652 for (i=0;i<n;i++)
18
Assuming 'i' is >= 'n'
19
Loop condition is false. Execution continues on line 2655
2653 if (!iwork[i])
2654 interior_dofs[n_interior_dofs++] = i;
2655 ierr = PetscFree(iwork)((*PetscTrFree)((void*)(iwork),2655,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((iwork) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2655,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2656 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),2656,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2657 }
2658 if (has_null_pressures) {
20
Taking true branch
2659 IS *subs;
2660 PetscInt nsubs,i,j,nl;
2661 const PetscInt *idxs;
2662 PetscScalar *array;
2663 Vec *work;
2664 Mat_IS* matis = (Mat_IS*)(pc->pmat->data);
2665
2666 subs = pcbddc->local_subs;
21
Value assigned to 'subs'
2667 nsubs = pcbddc->n_local_subs;
2668 /* 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) */
2669 if (checkb) {
22
Taking true branch
2670 ierr = VecDuplicateVecs(matis->y,2,&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2670,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2671 ierr = ISGetLocalSize(zerodiag,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2671,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2672 ierr = ISGetIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2672,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2673 /* work[0] = 1_p */
2674 ierr = VecSet(work[0],0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2674,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2675 ierr = VecGetArray(work[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2675,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2676 for (j=0;j<nl;j++) array[idxs[j]] = 1.;
23
Assuming 'j' is >= 'nl'
24
Loop condition is false. Execution continues on line 2677
2677 ierr = VecRestoreArray(work[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2677,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2678 /* work[0] = 1_v */
2679 ierr = VecSet(work[1],1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2679,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2680 ierr = VecGetArray(work[1],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2680,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2681 for (j=0;j<nl;j++) array[idxs[j]] = 0.;
25
Loop condition is false. Execution continues on line 2682
2682 ierr = VecRestoreArray(work[1],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2683 ierr = ISRestoreIndices(zerodiag,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2683,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2684 }
2685
2686 if (nsubs > 1 || bsp > 1) {
26
Assuming 'nsubs' is > 1
2687 IS *is;
2688 PetscInt b,totb;
2689
2690 totb = bsp;
2691 is = bsp > 1 ? bzerodiag : &zerodiag;
27
'?' condition is false
2692 nsubs = PetscMax(nsubs,1)(((nsubs)<(1)) ? (1) : (nsubs));
2693 ierr = PetscCalloc1(nsubs*totb,&zerodiag_subs)PetscMallocA(1,PETSC_TRUE,2693,__func__,"/sandbox/petsc/petsc.master/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),2693,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2694 for (b=0;b<totb;b++) {
28
Loop condition is true. Entering loop body
2695 for (i=0;i<nsubs;i++) {
29
Loop condition is true. Entering loop body
2696 ISLocalToGlobalMapping l2g;
2697 IS t_zerodiag_subs;
2698 PetscInt nl;
2699
2700 if (subs) {
30
Assuming 'subs' is null
31
Taking false branch
2701 ierr = ISLocalToGlobalMappingCreateIS(subs[i],&l2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2701,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2702 } else {
2703 IS tis;
2704
2705 ierr = MatGetLocalSize(pcbddc->local_mat,&nl,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2705,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2706 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),2706,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2707 ierr = ISLocalToGlobalMappingCreateIS(tis,&l2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2707,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2708 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2708,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2709 }
2710 ierr = ISGlobalToLocalMappingApplyIS(l2g,IS_GTOLM_DROP,is[b],&t_zerodiag_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2710,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2711 ierr = ISGetLocalSize(t_zerodiag_subs,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2711,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2712 if (nl) {
32
Assuming 'nl' is not equal to 0
33
Taking true branch
2713 PetscBool valid = PETSC_TRUE;
2714
2715 if (checkb) {
34
Taking true branch
2716 ierr = VecSet(matis->x,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2716,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2717 ierr = ISGetLocalSize(subs[i],&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2717,__func__,"/sandbox/petsc/petsc.master/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
2718 ierr = ISGetIndices(subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2718,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2719 ierr = VecGetArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2719,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2720 for (j=0;j<nl;j++) array[idxs[j]] = 1.;
2721 ierr = VecRestoreArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2721,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2722 ierr = ISRestoreIndices(subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2722,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2723 ierr = VecPointwiseMult(matis->x,work[0],matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2723,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2724 ierr = MatMult(matis->A,matis->x,matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2724,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2725 ierr = VecPointwiseMult(matis->y,work[1],matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2725,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2726 ierr = VecGetArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2726,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2727 for (j=0;j<n_interior_dofs;j++) {
2728 if (PetscAbsScalar(array[interior_dofs[j]])fabs(array[interior_dofs[j]]) > PETSC_SMALL1.e-10) {
2729 valid = PETSC_FALSE;
2730 break;
2731 }
2732 }
2733 ierr = VecRestoreArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2733,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2734 }
2735 if (valid && nneu) {
2736 const PetscInt *idxs;
2737 PetscInt nzb;
2738
2739 ierr = ISGetIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2739,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2740 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),2740,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2741 ierr = ISRestoreIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2741,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2742 if (nzb) valid = PETSC_FALSE;
2743 }
2744 if (valid && pressures) {
2745 IS t_pressure_subs,tmp;
2746 PetscInt i1,i2;
2747
2748 ierr = ISGlobalToLocalMappingApplyIS(l2g,IS_GTOLM_DROP,pressures,&t_pressure_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2748,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2749 ierr = ISEmbed(t_zerodiag_subs,t_pressure_subs,PETSC_TRUE,&tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2749,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2750 ierr = ISGetLocalSize(tmp,&i1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2750,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2751 ierr = ISGetLocalSize(t_zerodiag_subs,&i2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2751,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2752 if (i2 != i1) valid = PETSC_FALSE;
2753 ierr = ISDestroy(&t_pressure_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2753,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2754 ierr = ISDestroy(&tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2754,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2755 }
2756 if (valid) {
2757 ierr = ISLocalToGlobalMappingApplyIS(l2g,t_zerodiag_subs,&zerodiag_subs[benign_n]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2757,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2758 benign_n++;
2759 } else recompute_zerodiag = PETSC_TRUE;
2760 }
2761 ierr = ISDestroy(&t_zerodiag_subs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2761,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2762 ierr = ISLocalToGlobalMappingDestroy(&l2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2762,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2763 }
2764 }
2765 } else { /* there's just one subdomain (or zero if they have not been detected */
2766 PetscBool valid = PETSC_TRUE;
2767
2768 if (nneu) valid = PETSC_FALSE;
2769 if (valid && pressures) {
2770 ierr = ISEqual(pressures,zerodiag,&valid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2770,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2771 }
2772 if (valid && checkb) {
2773 ierr = MatMult(matis->A,work[0],matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2773,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2774 ierr = VecPointwiseMult(matis->x,work[1],matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2774,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2775 ierr = VecGetArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2775,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2776 for (j=0;j<n_interior_dofs;j++) {
2777 if (PetscAbsScalar(array[interior_dofs[j]])fabs(array[interior_dofs[j]]) > PETSC_SMALL1.e-10) {
2778 valid = PETSC_FALSE;
2779 break;
2780 }
2781 }
2782 ierr = VecRestoreArray(matis->x,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2782,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2783 }
2784 if (valid) {
2785 benign_n = 1;
2786 ierr = PetscMalloc1(benign_n,&zerodiag_subs)PetscMallocA(1,PETSC_FALSE,2786,__func__,"/sandbox/petsc/petsc.master/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),2786,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2787 ierr = PetscObjectReference((PetscObject)zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2787,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2788 zerodiag_subs[0] = zerodiag;
2789 }
2790 }
2791 if (checkb) {
2792 ierr = VecDestroyVecs(2,&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2792,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2793 }
2794 }
2795 ierr = PetscFree(interior_dofs)((*PetscTrFree)((void*)(interior_dofs),2795,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((interior_dofs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2795,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2796
2797 if (!benign_n) {
2798 PetscInt n;
2799
2800 ierr = ISDestroy(&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2800,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2801 recompute_zerodiag = PETSC_FALSE;
2802 ierr = MatGetLocalSize(pcbddc->local_mat,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2802,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2803 if (n) have_null = PETSC_FALSE;
2804 }
2805
2806 /* final check for null pressures */
2807 if (zerodiag && pressures) {
2808 ierr = ISEqual(pressures,zerodiag,&have_null);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2808,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2809 }
2810
2811 if (recompute_zerodiag) {
2812 ierr = ISDestroy(&zerodiag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2812,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2813 if (benign_n == 1) {
2814 ierr = PetscObjectReference((PetscObject)zerodiag_subs[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2814,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2815 zerodiag = zerodiag_subs[0];
2816 } else {
2817 PetscInt i,nzn,*new_idxs;
2818
2819 nzn = 0;
2820 for (i=0;i<benign_n;i++) {
2821 PetscInt ns;
2822 ierr = ISGetLocalSize(zerodiag_subs[i],&ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2822,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2823 nzn += ns;
2824 }
2825 ierr = PetscMalloc1(nzn,&new_idxs)PetscMallocA(1,PETSC_FALSE,2825,__func__,"/sandbox/petsc/petsc.master/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),2825,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2826 nzn = 0;
2827 for (i=0;i<benign_n;i++) {
2828 PetscInt ns,*idxs;
2829 ierr = ISGetLocalSize(zerodiag_subs[i],&ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2829,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2830 ierr = ISGetIndices(zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2830,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2831 ierr = PetscArraycpy(new_idxs+nzn,idxs,ns)((sizeof(*(new_idxs+nzn)) != sizeof(*(idxs))) || PetscMemcpy(
new_idxs+nzn,idxs,(ns)*sizeof(*(new_idxs+nzn))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2831,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2832 ierr = ISRestoreIndices(zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2832,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2833 nzn += ns;
2834 }
2835 ierr = PetscSortInt(nzn,new_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2835,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2836 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),2836,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2837 }
2838 have_null = PETSC_FALSE;
2839 }
2840
2841 /* determines if the coarse solver will be singular or not */
2842 ierr = MPIU_Allreduce(&have_null,&pcbddc->benign_null,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,2842,__func__,"/sandbox/petsc/petsc.master/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),2842,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2843
2844 /* Prepare matrix to compute no-net-flux */
2845 if (pcbddc->compute_nonetflux && !pcbddc->divudotp) {
2846 Mat A,loc_divudotp;
2847 ISLocalToGlobalMapping rl2g,cl2g,l2gmap;
2848 IS row,col,isused = NULL((void*)0);
2849 PetscInt M,N,n,st,n_isused;
2850
2851 if (pressures) {
2852 isused = pressures;
2853 } else {
2854 isused = zerodiag_save;
2855 }
2856 ierr = MatGetLocalToGlobalMapping(pc->pmat,&l2gmap,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2856,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2857 ierr = MatISGetLocalMat(pc->pmat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2857,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2858 ierr = MatGetLocalSize(A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2858,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2859 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),2859,__func__,"/sandbox/petsc/petsc.master/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"
)
;
2860 n_isused = 0;
2861 if (isused) {
2862 ierr = ISGetLocalSize(isused,&n_isused);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2862,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2863 }
2864 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),2864,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2865 st = st-n_isused;
2866 if (n) {
2867 const PetscInt *gidxs;
2868
2869 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),2869,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2870 ierr = ISLocalToGlobalMappingGetIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2870,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2871 /* TODO: extend ISCreateStride with st = PETSC_DECIDE */
2872 ierr = ISCreateStride(PetscObjectComm((PetscObject)pc),n_isused,st,1,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2872,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2873 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),n,gidxs,PETSC_COPY_VALUES,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2873,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2874 ierr = ISLocalToGlobalMappingRestoreIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2874,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2875 } else {
2876 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),2876,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2877 ierr = ISCreateStride(PetscObjectComm((PetscObject)pc),n_isused,st,1,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2877,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2878 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),2878,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2879 }
2880 ierr = MatGetSize(pc->pmat,NULL((void*)0),&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2880,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2881 ierr = ISGetSize(row,&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2881,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2882 ierr = ISLocalToGlobalMappingCreateIS(row,&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2882,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2883 ierr = ISLocalToGlobalMappingCreateIS(col,&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2883,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2884 ierr = ISDestroy(&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2884,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2885 ierr = ISDestroy(&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2885,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2886 ierr = MatCreate(PetscObjectComm((PetscObject)pc),&pcbddc->divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2886,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2887 ierr = MatSetType(pcbddc->divudotp,MATIS"is");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2887,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2888 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),2888,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2889 ierr = MatSetLocalToGlobalMapping(pcbddc->divudotp,rl2g,cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2889,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2890 ierr = ISLocalToGlobalMappingDestroy(&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2890,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2891 ierr = ISLocalToGlobalMappingDestroy(&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2891,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2892 ierr = MatISSetLocalMat(pcbddc->divudotp,loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2892,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2893 ierr = MatDestroy(&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2893,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2894 ierr = MatAssemblyBegin(pcbddc->divudotp,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2894,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2895 ierr = MatAssemblyEnd(pcbddc->divudotp,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2895,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2896 }
2897 ierr = ISDestroy(&zerodiag_save);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2897,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2898 ierr = ISDestroy(&pressures);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2898,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2899 if (bzerodiag) {
2900 PetscInt i;
2901
2902 for (i=0;i<bsp;i++) {
2903 ierr = ISDestroy(&bzerodiag[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2903,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2904 }
2905 ierr = PetscFree(bzerodiag)((*PetscTrFree)((void*)(bzerodiag),2905,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((bzerodiag) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2905,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2906 }
2907 pcbddc->benign_n = benign_n;
2908 pcbddc->benign_zerodiag_subs = zerodiag_subs;
2909
2910 /* determines if the problem has subdomains with 0 pressure block */
2911 have_null = (PetscBool)(!!pcbddc->benign_n);
2912 ierr = MPIU_Allreduce(&have_null,&pcbddc->benign_have_null,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,2912,__func__,"/sandbox/petsc/petsc.master/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),2912,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2913
2914project_b0:
2915 ierr = MatGetLocalSize(pcbddc->local_mat,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2915,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2916 /* change of basis and p0 dofs */
2917 if (pcbddc->benign_n) {
2918 PetscInt i,s,*nnz;
2919
2920 /* local change of basis for pressures */
2921 ierr = MatDestroy(&pcbddc->benign_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2921,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2922 ierr = MatCreate(PetscObjectComm((PetscObject)pcbddc->local_mat),&pcbddc->benign_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2922,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2923 ierr = MatSetType(pcbddc->benign_change,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2923,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2924 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),2924,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2925 ierr = PetscMalloc1(n,&nnz)PetscMallocA(1,PETSC_FALSE,2925,__func__,"/sandbox/petsc/petsc.master/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),2925,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2926 for (i=0;i<n;i++) nnz[i] = 1; /* defaults to identity */
2927 for (i=0;i<pcbddc->benign_n;i++) {
2928 const PetscInt *idxs;
2929 PetscInt nzs,j;
2930
2931 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[i],&nzs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2931,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2932 ierr = ISGetIndices(pcbddc->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2932,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2933 for (j=0;j<nzs-1;j++) nnz[idxs[j]] = 2; /* change on pressures */
2934 nnz[idxs[nzs-1]] = nzs; /* last local pressure dof in subdomain */
2935 ierr = ISRestoreIndices(pcbddc->benign_zerodiag_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2935,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2936 }
2937 ierr = MatSeqAIJSetPreallocation(pcbddc->benign_change,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2937,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2938 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),2938,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2939 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),2939,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2939,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2940 /* set identity by default */
2941 for (i=0;i<n;i++) {
2942 ierr = MatSetValue(pcbddc->benign_change,i,i,1.,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2942,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2943 }
2944 ierr = PetscFree3(pcbddc->benign_p0_lidx,pcbddc->benign_p0_gidx,pcbddc->benign_p0)PetscFreeA(3,2944,__func__,"/sandbox/petsc/petsc.master/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),2944,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2945 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,2945,__func__,"/sandbox/petsc/petsc.master/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),2945,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2946 /* set change on pressures */
2947 for (s=0;s<pcbddc->benign_n;s++) {
2948 PetscScalar *array;
2949 const PetscInt *idxs;
2950 PetscInt nzs;
2951
2952 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[s],&nzs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2952,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2953 ierr = ISGetIndices(pcbddc->benign_zerodiag_subs[s],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2953,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2954 for (i=0;i<nzs-1;i++) {
2955 PetscScalar vals[2];
2956 PetscInt cols[2];
2957
2958 cols[0] = idxs[i];
2959 cols[1] = idxs[nzs-1];
2960 vals[0] = 1.;
2961 vals[1] = 1.;
2962 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),2962,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2963 }
2964 ierr = PetscMalloc1(nzs,&array)PetscMallocA(1,PETSC_FALSE,2964,__func__,"/sandbox/petsc/petsc.master/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),2964,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2965 for (i=0;i<nzs-1;i++) array[i] = -1.;
2966 array[nzs-1] = 1.;
2967 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),2967,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2968 /* store local idxs for p0 */
2969 pcbddc->benign_p0_lidx[s] = idxs[nzs-1];
2970 ierr = ISRestoreIndices(pcbddc->benign_zerodiag_subs[s],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2970,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2971 ierr = PetscFree(array)((*PetscTrFree)((void*)(array),2971,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((array) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2971,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2972 }
2973 ierr = MatAssemblyBegin(pcbddc->benign_change,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2973,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2974 ierr = MatAssemblyEnd(pcbddc->benign_change,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2974,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2975
2976 /* project if needed */
2977 if (pcbddc->benign_change_explicit) {
2978 Mat M;
2979
2980 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),2980,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2981 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2981,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2982 ierr = MatSeqAIJCompress(M,&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2982,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2983 ierr = MatDestroy(&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2983,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2984 }
2985 /* store global idxs for p0 */
2986 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),2986,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2987 }
2988 *zerodiaglocal = zerodiag;
2989 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
2990}
2991
2992PetscErrorCode PCBDDCBenignGetOrSetP0(PC pc, Vec v, PetscBool get)
2993{
2994 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
2995 PetscScalar *array;
2996 PetscErrorCode ierr;
2997
2998 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 2998; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2999 if (!pcbddc->benign_sf) {
3000 ierr = PetscSFCreate(PetscObjectComm((PetscObject)pc),&pcbddc->benign_sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3000,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3001 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),3001,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3002 }
3003 if (get) {
3004 ierr = VecGetArrayRead(v,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3004,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3005 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),3005,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3006 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),3006,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3007 ierr = VecRestoreArrayRead(v,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3007,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3008 } else {
3009 ierr = VecGetArray(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3009,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3010 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),3010,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3011 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),3011,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3012 ierr = VecRestoreArray(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3012,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3013 }
3014 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3015}
3016
3017PetscErrorCode PCBDDCBenignPopOrPushB0(PC pc, PetscBool pop)
3018{
3019 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
3020 PetscErrorCode ierr;
3021
3022 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3022; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3023 /* TODO: add error checking
3024 - avoid nested pop (or push) calls.
3025 - cannot push before pop.
3026 - cannot call this if pcbddc->local_mat is NULL
3027 */
3028 if (!pcbddc->benign_n) {
3029 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3030 }
3031 if (pop) {
3032 if (pcbddc->benign_change_explicit) {
3033 IS is_p0;
3034 MatReuse reuse;
3035
3036 /* extract B_0 */
3037 reuse = MAT_INITIAL_MATRIX;
3038 if (pcbddc->benign_B0) {
3039 reuse = MAT_REUSE_MATRIX;
3040 }
3041 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),3041,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3042 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),3042,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3043 /* remove rows and cols from local problem */
3044 ierr = MatSetOption(pcbddc->local_mat,MAT_KEEP_NONZERO_PATTERN,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3044,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3045 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),3045,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3046 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),3046,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3047 ierr = ISDestroy(&is_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3047,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3048 } else {
3049 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
3050 PetscScalar *vals;
3051 PetscInt i,n,*idxs_ins;
3052
3053 ierr = VecGetLocalSize(matis->y,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3053,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3054 ierr = PetscMalloc2(n,&idxs_ins,n,&vals)PetscMallocA(2,PETSC_FALSE,3054,__func__,"/sandbox/petsc/petsc.master/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),3054,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3055 if (!pcbddc->benign_B0) {
3056 PetscInt *nnz;
3057 ierr = MatCreate(PetscObjectComm((PetscObject)pcbddc->local_mat),&pcbddc->benign_B0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3057,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3058 ierr = MatSetType(pcbddc->benign_B0,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3058,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3059 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),3059,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3060 ierr = PetscMalloc1(pcbddc->benign_n,&nnz)PetscMallocA(1,PETSC_FALSE,3060,__func__,"/sandbox/petsc/petsc.master/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),3060,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3061 for (i=0;i<pcbddc->benign_n;i++) {
3062 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[i],&nnz[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3062,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3063 nnz[i] = n - nnz[i];
3064 }
3065 ierr = MatSeqAIJSetPreallocation(pcbddc->benign_B0,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3065,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3066 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),3066,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3067 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),3067,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3067,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3068 }
3069
3070 for (i=0;i<pcbddc->benign_n;i++) {
3071 PetscScalar *array;
3072 PetscInt *idxs,j,nz,cum;
3073
3074 ierr = VecSet(matis->x,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3074,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3075 ierr = ISGetLocalSize(pcbddc->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3075,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3076 ierr = ISGetIndices(pcbddc->benign_zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3076,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3077 for (j=0;j<nz;j++) vals[j] = 1.;
3078 ierr = VecSetValues(matis->x,nz,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3078,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3079 ierr = VecAssemblyBegin(matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3079,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3080 ierr = VecAssemblyEnd(matis->x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3080,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3081 ierr = VecSet(matis->y,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3081,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3082 ierr = MatMult(matis->A,matis->x,matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3082,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3083 ierr = VecGetArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3083,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3084 cum = 0;
3085 for (j=0;j<n;j++) {
3086 if (PetscUnlikely(PetscAbsScalar(array[j]) > PETSC_SMALL)__builtin_expect(!!(fabs(array[j]) > 1.e-10),0)) {
3087 vals[cum] = array[j];
3088 idxs_ins[cum] = j;
3089 cum++;
3090 }
3091 }
3092 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),3092,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3093 ierr = VecRestoreArray(matis->y,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3093,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3094 ierr = ISRestoreIndices(pcbddc->benign_zerodiag_subs[i],(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3094,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3095 }
3096 ierr = MatAssemblyBegin(pcbddc->benign_B0,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3096,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3097 ierr = MatAssemblyEnd(pcbddc->benign_B0,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3097,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3098 ierr = PetscFree2(idxs_ins,vals)PetscFreeA(2,3098,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(idxs_ins),&(vals))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3098,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3099 }
3100 } else { /* push */
3101 if (pcbddc->benign_change_explicit) {
3102 PetscInt i;
3103
3104 for (i=0;i<pcbddc->benign_n;i++) {
3105 PetscScalar *B0_vals;
3106 PetscInt *B0_cols,B0_ncol;
3107
3108 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),3108,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3109 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),3109,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3110 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),3110,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3111 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),3111,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3112 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),3112,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3113 }
3114 ierr = MatAssemblyBegin(pcbddc->local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3114,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3115 ierr = MatAssemblyEnd(pcbddc->local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3115,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3116 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Cannot push B0!")return PetscError(((MPI_Comm)0x44000001),3116,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Cannot push B0!")
;
3117 }
3118 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3119}
3120
3121PetscErrorCode PCBDDCAdaptiveSelection(PC pc)
3122{
3123 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
3124 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
3125 PetscBLASInt B_dummyint,B_neigs,B_ierr,B_lwork;
3126 PetscBLASInt *B_iwork,*B_ifail;
3127 PetscScalar *work,lwork;
3128 PetscScalar *St,*S,*eigv;
3129 PetscScalar *Sarray,*Starray;
3130 PetscReal *eigs,thresh,lthresh,uthresh;
3131 PetscInt i,nmax,nmin,nv,cum,mss,cum2,cumarray,maxneigs;
3132 PetscBool allocated_S_St;
3133#if defined(PETSC_USE_COMPLEX)
3134 PetscReal *rwork;
3135#endif
3136 PetscErrorCode ierr;
3137
3138 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3138; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3139 if (!sub_schurs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Adaptive selection of constraints requires SubSchurs data")return PetscError(((MPI_Comm)0x44000001),3139,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Adaptive selection of constraints requires SubSchurs data"
)
;
3140 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),3140,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Adaptive selection of constraints requires MUMPS and/or MKL_CPARDISO"
)
;
3141 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),3141,__func__,"/sandbox/petsc/petsc.master/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)
;
3142 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),3142,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3143
3144 if (pcbddc->dbg_flag) {
3145 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3145,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3146 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3146,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3147 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Check adaptive selection of constraints\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3147,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3148 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3148,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3149 }
3150
3151 if (pcbddc->dbg_flag) {
3152 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),3152,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3153 }
3154
3155 /* max size of subsets */
3156 mss = 0;
3157 for (i=0;i<sub_schurs->n_subs;i++) {
3158 PetscInt subset_size;
3159
3160 ierr = ISGetLocalSize(sub_schurs->is_subs[i],&subset_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3160,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3161 mss = PetscMax(mss,subset_size)(((mss)<(subset_size)) ? (subset_size) : (mss));
3162 }
3163
3164 /* min/max and threshold */
3165 nmax = pcbddc->adaptive_nmax > 0 ? pcbddc->adaptive_nmax : mss;
3166 nmin = pcbddc->adaptive_nmin > 0 ? pcbddc->adaptive_nmin : 0;
3167 nmax = PetscMax(nmin,nmax)(((nmin)<(nmax)) ? (nmax) : (nmin));
3168 allocated_S_St = PETSC_FALSE;
3169 if (nmin || !sub_schurs->is_posdef) { /* XXX */
3170 allocated_S_St = PETSC_TRUE;
3171 }
3172
3173 /* allocate lapack workspace */
3174 cum = cum2 = 0;
3175 maxneigs = 0;
3176 for (i=0;i<sub_schurs->n_subs;i++) {
3177 PetscInt n,subset_size;
3178
3179 ierr = ISGetLocalSize(sub_schurs->is_subs[i],&subset_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3179,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3180 n = PetscMin(subset_size,nmax)(((subset_size)<(nmax)) ? (subset_size) : (nmax));
3181 cum += subset_size;
3182 cum2 += subset_size*n;
3183 maxneigs = PetscMax(maxneigs,n)(((maxneigs)<(n)) ? (n) : (maxneigs));
3184 }
3185 if (mss) {
3186 if (sub_schurs->is_symmetric) {
3187 PetscBLASInt B_itype = 1;
3188 PetscBLASInt B_N = mss;
3189 PetscReal zero = 0.0;
3190 PetscReal eps = 0.0; /* dlamch? */
3191
3192 B_lwork = -1;
3193 S = NULL((void*)0);
3194 St = NULL((void*)0);
3195 eigs = NULL((void*)0);
3196 eigv = NULL((void*)0);
3197 B_iwork = NULL((void*)0);
3198 B_ifail = NULL((void*)0);
3199#if defined(PETSC_USE_COMPLEX)
3200 rwork = NULL((void*)0);
3201#endif
3202 thresh = 1.0;
3203 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3203,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3204#if defined(PETSC_USE_COMPLEX)
3205 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3205; 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(3205,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3205,__func__,"/sandbox/petsc/petsc.master/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)
;
3206#else
3207 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3207; 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
(3207,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3207,__func__,"/sandbox/petsc/petsc.master/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)
;
3208#endif
3209 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),3209,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to SYGVX Lapack routine %d"
,(int)B_ierr)
;
3210 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3210,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3211 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented")return PetscError(((MPI_Comm)0x44000001),3211,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
3212 } else {
3213 lwork = 0;
3214 }
3215
3216 nv = 0;
3217 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) */
3218 ierr = ISGetLocalSize(sub_schurs->is_vertices,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3218,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3219 }
3220 ierr = PetscBLASIntCast((PetscInt)PetscRealPart(lwork)(lwork),&B_lwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3220,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3221 if (allocated_S_St) {
3222 ierr = PetscMalloc2(mss*mss,&S,mss*mss,&St)PetscMallocA(2,PETSC_FALSE,3222,__func__,"/sandbox/petsc/petsc.master/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),3222,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3223 }
3224 ierr = PetscMalloc5(mss*mss,&eigv,mss,&eigs,B_lwork,&work,5*mss,&B_iwork,mss,&B_ifail)PetscMallocA(5,PETSC_FALSE,3224,__func__,"/sandbox/petsc/petsc.master/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),3224,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3225#if defined(PETSC_USE_COMPLEX)
3226 ierr = PetscMalloc1(7*mss,&rwork)PetscMallocA(1,PETSC_FALSE,3226,__func__,"/sandbox/petsc/petsc.master/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),3226,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3227#endif
3228 ierr = PetscMalloc5(nv+sub_schurs->n_subs,&pcbddc->adaptive_constraints_n,PetscMallocA(5,PETSC_FALSE,3232,__func__,"/sandbox/petsc/petsc.master/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_idxs_ptr,PetscMallocA(5,PETSC_FALSE,3232,__func__,"/sandbox/petsc/petsc.master/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+sub_schurs->n_subs+1,&pcbddc->adaptive_constraints_data_ptr,PetscMallocA(5,PETSC_FALSE,3232,__func__,"/sandbox/petsc/petsc.master/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+cum,&pcbddc->adaptive_constraints_idxs,PetscMallocA(5,PETSC_FALSE,3232,__func__,"/sandbox/petsc/petsc.master/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))
3232 nv+cum2,&pcbddc->adaptive_constraints_data)PetscMallocA(5,PETSC_FALSE,3232,__func__,"/sandbox/petsc/petsc.master/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),3232,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3233 ierr = PetscArrayzero(pcbddc->adaptive_constraints_n,nv+sub_schurs->n_subs)PetscMemzero(pcbddc->adaptive_constraints_n,(nv+sub_schurs
->n_subs)*sizeof(*(pcbddc->adaptive_constraints_n)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3233,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3234
3235 maxneigs = 0;
3236 cum = cumarray = 0;
3237 pcbddc->adaptive_constraints_idxs_ptr[0] = 0;
3238 pcbddc->adaptive_constraints_data_ptr[0] = 0;
3239 if (sub_schurs->is_vertices && pcbddc->use_vertices) {
3240 const PetscInt *idxs;
3241
3242 ierr = ISGetIndices(sub_schurs->is_vertices,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3242,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3243 for (cum=0;cum<nv;cum++) {
3244 pcbddc->adaptive_constraints_n[cum] = 1;
3245 pcbddc->adaptive_constraints_idxs[cum] = idxs[cum];
3246 pcbddc->adaptive_constraints_data[cum] = 1.0;
3247 pcbddc->adaptive_constraints_idxs_ptr[cum+1] = pcbddc->adaptive_constraints_idxs_ptr[cum]+1;
3248 pcbddc->adaptive_constraints_data_ptr[cum+1] = pcbddc->adaptive_constraints_data_ptr[cum]+1;
3249 }
3250 ierr = ISRestoreIndices(sub_schurs->is_vertices,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3251 }
3252
3253 if (mss) { /* multilevel */
3254 ierr = MatSeqAIJGetArray(sub_schurs->sum_S_Ej_inv_all,&Sarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3254,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3255 ierr = MatSeqAIJGetArray(sub_schurs->sum_S_Ej_tilda_all,&Starray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3255,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3256 }
3257
3258 lthresh = pcbddc->adaptive_threshold[0];
3259 uthresh = pcbddc->adaptive_threshold[1];
3260 for (i=0;i<sub_schurs->n_subs;i++) {
3261 const PetscInt *idxs;
3262 PetscReal upper,lower;
3263 PetscInt j,subset_size,eigs_start = 0;
3264 PetscBLASInt B_N;
3265 PetscBool same_data = PETSC_FALSE;
3266 PetscBool scal = PETSC_FALSE;
3267
3268 if (pcbddc->use_deluxe_scaling) {
3269 upper = PETSC_MAX_REAL1.7976931348623157e+308;
3270 lower = uthresh;
3271 } else {
3272 if (!sub_schurs->is_posdef) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented without deluxe scaling")return PetscError(((MPI_Comm)0x44000001),3272,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented without deluxe scaling"
)
;
3273 upper = 1./uthresh;
3274 lower = 0.;
3275 }
3276 ierr = ISGetLocalSize(sub_schurs->is_subs[i],&subset_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3276,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3277 ierr = ISGetIndices(sub_schurs->is_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3277,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3278 ierr = PetscBLASIntCast(subset_size,&B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3278,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3279 /* this is experimental: we assume the dofs have been properly grouped to have
3280 the diagonal blocks Schur complements either positive or negative definite (true for Stokes) */
3281 if (!sub_schurs->is_posdef) {
3282 Mat T;
3283
3284 for (j=0;j<subset_size;j++) {
3285 if (PetscRealPart(*(Sarray+cumarray+j*(subset_size+1)))(*(Sarray+cumarray+j*(subset_size+1))) < 0.0) {
3286 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),3286,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3287 ierr = MatScale(T,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3287,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3288 ierr = MatDestroy(&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3288,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3289 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),3289,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3290 ierr = MatScale(T,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3290,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3291 ierr = MatDestroy(&T);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3291,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3292 if (sub_schurs->change_primal_sub) {
3293 PetscInt nz,k;
3294 const PetscInt *idxs;
3295
3296 ierr = ISGetLocalSize(sub_schurs->change_primal_sub[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3296,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3297 ierr = ISGetIndices(sub_schurs->change_primal_sub[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3297,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3298 for (k=0;k<nz;k++) {
3299 *( Sarray + cumarray + idxs[k]*(subset_size+1)) *= -1.0;
3300 *(Starray + cumarray + idxs[k]*(subset_size+1)) = 0.0;
3301 }
3302 ierr = ISRestoreIndices(sub_schurs->change_primal_sub[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3302,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3303 }
3304 scal = PETSC_TRUE;
3305 break;
3306 }
3307 }
3308 }
3309
3310 if (allocated_S_St) { /* S and S_t should be copied since we could need them later */
3311 if (sub_schurs->is_symmetric) {
3312 PetscInt j,k;
3313 if (sub_schurs->n_subs == 1) { /* zeroing memory to use PetscArraycmp() later */
3314 ierr = PetscArrayzero(S,subset_size*subset_size)PetscMemzero(S,(subset_size*subset_size)*sizeof(*(S)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3314,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3315 ierr = PetscArrayzero(St,subset_size*subset_size)PetscMemzero(St,(subset_size*subset_size)*sizeof(*(St)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3315,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3316 }
3317 for (j=0;j<subset_size;j++) {
3318 for (k=j;k<subset_size;k++) {
3319 S [j*subset_size+k] = Sarray [cumarray+j*subset_size+k];
3320 St[j*subset_size+k] = Starray[cumarray+j*subset_size+k];
3321 }
3322 }
3323 } else {
3324 ierr = PetscArraycpy(S,Sarray+cumarray,subset_size*subset_size)((sizeof(*(S)) != sizeof(*(Sarray+cumarray))) || PetscMemcpy(
S,Sarray+cumarray,(subset_size*subset_size)*sizeof(*(S))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3324,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3325 ierr = PetscArraycpy(St,Starray+cumarray,subset_size*subset_size)((sizeof(*(St)) != sizeof(*(Starray+cumarray))) || PetscMemcpy
(St,Starray+cumarray,(subset_size*subset_size)*sizeof(*(St)))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3325,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3326 }
3327 } else {
3328 S = Sarray + cumarray;
3329 St = Starray + cumarray;
3330 }
3331 /* see if we can save some work */
3332 if (sub_schurs->n_subs == 1 && pcbddc->use_deluxe_scaling) {
3333 ierr = PetscArraycmp(S,St,subset_size*subset_size,&same_data)((sizeof(*(S)) != sizeof(*(St))) || PetscMemcmp(S,St,(subset_size
*subset_size)*sizeof(*(S)),&same_data))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3333,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3334 }
3335
3336 if (same_data && !sub_schurs->change) { /* there's no need of constraints here */
3337 B_neigs = 0;
3338 } else {
3339 if (sub_schurs->is_symmetric) {
3340 PetscBLASInt B_itype = 1;
3341 PetscBLASInt B_IL, B_IU;
3342 PetscReal eps = -1.0; /* dlamch? */
3343 PetscInt nmin_s;
3344 PetscBool compute_range;
3345
3346 B_neigs = 0;
3347 compute_range = (PetscBool)!same_data;
3348 if (nmin >= subset_size) compute_range = PETSC_FALSE;
3349
3350 if (pcbddc->dbg_flag) {
3351 PetscInt nc = 0;
3352
3353 if (sub_schurs->change_primal_sub) {
3354 ierr = ISGetLocalSize(sub_schurs->change_primal_sub[i],&nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3354,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3355 }
3356 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),3356,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3357 }
3358
3359 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3359,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3360 if (compute_range) {
3361
3362 /* ask for eigenvalues larger than thresh */
3363 if (sub_schurs->is_posdef) {
3364#if defined(PETSC_USE_COMPLEX)
3365 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3365; 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
(3365,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3365,__func__,"/sandbox/petsc/petsc.master/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)
;
3366#else
3367 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3367; 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(3367
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3367,__func__,"/sandbox/petsc/petsc.master/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)
;
3368#endif
3369 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),3369,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3370 } else { /* no theory so far, but it works nicely */
3371 PetscInt recipe = 0,recipe_m = 1;
3372 PetscReal bb[2];
3373
3374 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),3374,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3375 switch (recipe) {
3376 case 0:
3377 if (scal) { bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308); bb[1] = lthresh; }
3378 else { bb[0] = uthresh; bb[1] = PETSC_MAX_REAL1.7976931348623157e+308; }
3379#if defined(PETSC_USE_COMPLEX)
3380 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3380; 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
(3380,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3380,__func__,"/sandbox/petsc/petsc.master/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)
;
3381#else
3382 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3382; 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(3382
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3382,__func__,"/sandbox/petsc/petsc.master/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)
;
3383#endif
3384 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),3384,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3385 break;
3386 case 1:
3387 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308); bb[1] = lthresh*lthresh;
3388#if defined(PETSC_USE_COMPLEX)
3389 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3389; 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
(3389,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3389,__func__,"/sandbox/petsc/petsc.master/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)
;
3390#else
3391 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3391; 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(3391
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3391,__func__,"/sandbox/petsc/petsc.master/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)
;
3392#endif
3393 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),3393,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3394 if (!scal) {
3395 PetscBLASInt B_neigs2 = 0;
3396
3397 bb[0] = PetscMax(lthresh*lthresh,uthresh)(((lthresh*lthresh)<(uthresh)) ? (uthresh) : (lthresh*lthresh
))
; bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3398 ierr = PetscArraycpy(S,Sarray+cumarray,subset_size*subset_size)((sizeof(*(S)) != sizeof(*(Sarray+cumarray))) || PetscMemcpy(
S,Sarray+cumarray,(subset_size*subset_size)*sizeof(*(S))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3398,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3399 ierr = PetscArraycpy(St,Starray+cumarray,subset_size*subset_size)((sizeof(*(St)) != sizeof(*(Starray+cumarray))) || PetscMemcpy
(St,Starray+cumarray,(subset_size*subset_size)*sizeof(*(St)))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3399,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3400#if defined(PETSC_USE_COMPLEX)
3401 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3401; 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(3401,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3401,__func__,"/sandbox/petsc/petsc.master/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)
;
3402#else
3403 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3403; 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
(3403,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3403,__func__,"/sandbox/petsc/petsc.master/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)
;
3404#endif
3405 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),3405,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3406 B_neigs += B_neigs2;
3407 }
3408 break;
3409 case 2:
3410 if (scal) {
3411 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308);
3412 bb[1] = 0;
3413#if defined(PETSC_USE_COMPLEX)
3414 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3414; 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
(3414,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3414,__func__,"/sandbox/petsc/petsc.master/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)
;
3415#else
3416 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3416; 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(3416
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3416,__func__,"/sandbox/petsc/petsc.master/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)
;
3417#endif
3418 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),3418,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3419 } else {
3420 PetscBLASInt B_neigs2 = 0;
3421 PetscBool import = PETSC_FALSE;
3422
3423 lthresh = PetscMax(lthresh,0.0)(((lthresh)<(0.0)) ? (0.0) : (lthresh));
3424 if (lthresh > 0.0) {
3425 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308);
3426 bb[1] = lthresh*lthresh;
3427
3428 import = PETSC_TRUE;
3429#if defined(PETSC_USE_COMPLEX)
3430 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3430; 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
(3430,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3430,__func__,"/sandbox/petsc/petsc.master/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)
;
3431#else
3432 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3432; 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(3432
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3432,__func__,"/sandbox/petsc/petsc.master/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)
;
3433#endif
3434 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),3434,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3435 }
3436 bb[0] = PetscMax(lthresh*lthresh,uthresh)(((lthresh*lthresh)<(uthresh)) ? (uthresh) : (lthresh*lthresh
))
;
3437 bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3438 if (import) {
3439 ierr = PetscArraycpy(S,Sarray+cumarray,subset_size*subset_size)((sizeof(*(S)) != sizeof(*(Sarray+cumarray))) || PetscMemcpy(
S,Sarray+cumarray,(subset_size*subset_size)*sizeof(*(S))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3439,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3440 ierr = PetscArraycpy(St,Starray+cumarray,subset_size*subset_size)((sizeof(*(St)) != sizeof(*(Starray+cumarray))) || PetscMemcpy
(St,Starray+cumarray,(subset_size*subset_size)*sizeof(*(St)))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3440,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3441 }
3442#if defined(PETSC_USE_COMPLEX)
3443 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3443; 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(3443,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3443,__func__,"/sandbox/petsc/petsc.master/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)
;
3444#else
3445 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3445; 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
(3445,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3445,__func__,"/sandbox/petsc/petsc.master/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)
;
3446#endif
3447 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),3447,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3448 B_neigs += B_neigs2;
3449 }
3450 break;
3451 case 3:
3452 if (scal) {
3453 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),3453,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3454 } else {
3455 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),3455,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3456 }
3457 if (!scal) {
3458 bb[0] = uthresh;
3459 bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3460#if defined(PETSC_USE_COMPLEX)
3461 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3461; 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
(3461,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3461,__func__,"/sandbox/petsc/petsc.master/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)
;
3462#else
3463 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3463; 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(3463
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3463,__func__,"/sandbox/petsc/petsc.master/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)
;
3464#endif
3465 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),3465,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3466 }
3467 if (recipe_m > 0 && B_N - B_neigs > 0) {
3468 PetscBLASInt B_neigs2 = 0;
3469
3470 B_IL = 1;
3471 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),3471,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3472 ierr = PetscArraycpy(S,Sarray+cumarray,subset_size*subset_size)((sizeof(*(S)) != sizeof(*(Sarray+cumarray))) || PetscMemcpy(
S,Sarray+cumarray,(subset_size*subset_size)*sizeof(*(S))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3472,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3473 ierr = PetscArraycpy(St,Starray+cumarray,subset_size*subset_size)((sizeof(*(St)) != sizeof(*(Starray+cumarray))) || PetscMemcpy
(St,Starray+cumarray,(subset_size*subset_size)*sizeof(*(St)))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3473,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3474#if defined(PETSC_USE_COMPLEX)
3475 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3475; 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(3475,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3475,__func__,"/sandbox/petsc/petsc.master/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)
;
3476#else
3477 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3477; 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
(3477,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3477,__func__,"/sandbox/petsc/petsc.master/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)
;
3478#endif
3479 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),3479,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3480 B_neigs += B_neigs2;
3481 }
3482 break;
3483 case 4:
3484 bb[0] = PETSC_MIN_REAL(-1.7976931348623157e+308); bb[1] = lthresh;
3485#if defined(PETSC_USE_COMPLEX)
3486 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3486; 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
(3486,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3486,__func__,"/sandbox/petsc/petsc.master/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)
;
3487#else
3488 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3488; 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(3488
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3488,__func__,"/sandbox/petsc/petsc.master/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)
;
3489#endif
3490 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),3490,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3491 {
3492 PetscBLASInt B_neigs2 = 0;
3493
3494 bb[0] = PetscMax(lthresh+PETSC_SMALL,uthresh)(((lthresh+1.e-10)<(uthresh)) ? (uthresh) : (lthresh+1.e-10
))
; bb[1] = PETSC_MAX_REAL1.7976931348623157e+308;
3495 ierr = PetscArraycpy(S,Sarray+cumarray,subset_size*subset_size)((sizeof(*(S)) != sizeof(*(Sarray+cumarray))) || PetscMemcpy(
S,Sarray+cumarray,(subset_size*subset_size)*sizeof(*(S))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3495,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3496 ierr = PetscArraycpy(St,Starray+cumarray,subset_size*subset_size)((sizeof(*(St)) != sizeof(*(Starray+cumarray))) || PetscMemcpy
(St,Starray+cumarray,(subset_size*subset_size)*sizeof(*(St)))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3496,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3497#if defined(PETSC_USE_COMPLEX)
3498 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3498; 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(3498,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3498,__func__,"/sandbox/petsc/petsc.master/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)
;
3499#else
3500 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3500; 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
(3500,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3500,__func__,"/sandbox/petsc/petsc.master/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)
;
3501#endif
3502 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),3502,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3503 B_neigs += B_neigs2;
3504 }
3505 break;
3506 case 5: /* same as before: first compute all eigenvalues, then filter */
3507#if defined(PETSC_USE_COMPLEX)
3508 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3508; 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
(3508,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3508,__func__,"/sandbox/petsc/petsc.master/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)
;
3509#else
3510 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3510; 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(3510
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3510,__func__,"/sandbox/petsc/petsc.master/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)
;
3511#endif
3512 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),3512,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3513 {
3514 PetscInt e,k,ne;
3515 for (e=0,ne=0;e<B_neigs;e++) {
3516 if (eigs[e] < lthresh || eigs[e] > uthresh) {
3517 for (k=0;k<B_N;k++) S[ne*B_N+k] = eigv[e*B_N+k];
3518 eigs[ne] = eigs[e];
3519 ne++;
3520 }
3521 }
3522 ierr = PetscArraycpy(eigv,S,B_N*ne)((sizeof(*(eigv)) != sizeof(*(S))) || PetscMemcpy(eigv,S,(B_N
*ne)*sizeof(*(eigv))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3522,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3523 B_neigs = ne;
3524 }
3525 break;
3526 default:
3527 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_SUP,"Unknown recipe %D",recipe)return PetscError(PetscObjectComm((PetscObject)pc),3527,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Unknown recipe %D",recipe)
;
3528 break;
3529 }
3530 }
3531 } else if (!same_data) { /* this is just to see all the eigenvalues */
3532 B_IU = PetscMax(1,PetscMin(B_N,nmax))(((1)<((((B_N)<(nmax)) ? (B_N) : (nmax)))) ? ((((B_N)<
(nmax)) ? (B_N) : (nmax))) : (1))
;
3533 B_IL = 1;
3534#if defined(PETSC_USE_COMPLEX)
3535 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3535; 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
(3535,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3535,__func__,"/sandbox/petsc/petsc.master/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)
;
3536#else
3537 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3537; 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(3537
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3537,__func__,"/sandbox/petsc/petsc.master/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)
;
3538#endif
3539 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),3539,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3540 } else { /* same_data is true, so just get the adaptive functional requested by the user */
3541 PetscInt k;
3542 if (!sub_schurs->change_primal_sub) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"This should not happen")return PetscError(((MPI_Comm)0x44000001),3542,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
3543 ierr = ISGetLocalSize(sub_schurs->change_primal_sub[i],&nmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3543,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3544 ierr = PetscBLASIntCast(nmax,&B_neigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3544,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3545 nmin = nmax;
3546 ierr = PetscArrayzero(eigv,subset_size*nmax)PetscMemzero(eigv,(subset_size*nmax)*sizeof(*(eigv)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3546,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3547 for (k=0;k<nmax;k++) {
3548 eigs[k] = 1./PETSC_SMALL1.e-10;
3549 eigv[k*(subset_size+1)] = 1.0;
3550 }
3551 }
3552 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3552,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3553 if (B_ierr) {
3554 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),3554,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: illegal value for argument %d"
,-(int)B_ierr)
;
3555 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),3555,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: %d eigenvalues failed to converge"
,(int)B_ierr)
;
3556 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),3556,__func__,"/sandbox/petsc/petsc.master/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)
;
3557 }
3558
3559 if (B_neigs > nmax) {
3560 if (pcbddc->dbg_flag) {
3561 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),3561,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3562 }
3563 if (pcbddc->use_deluxe_scaling) eigs_start = scal ? 0 : B_neigs-nmax;
3564 B_neigs = nmax;
3565 }
3566
3567 nmin_s = PetscMin(nmin,B_N)(((nmin)<(B_N)) ? (nmin) : (B_N));
3568 if (B_neigs < nmin_s) {
3569 PetscBLASInt B_neigs2 = 0;
3570
3571 if (pcbddc->use_deluxe_scaling) {
3572 if (scal) {
3573 B_IU = nmin_s;
3574 B_IL = B_neigs + 1;
3575 } else {
3576 B_IL = B_N - nmin_s + 1;
3577 B_IU = B_N - B_neigs;
3578 }
3579 } else {
3580 B_IL = B_neigs + 1;
3581 B_IU = nmin_s;
3582 }
3583 if (pcbddc->dbg_flag) {
3584 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),3584,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3585 }
3586 if (sub_schurs->is_symmetric) {
3587 PetscInt j,k;
3588 for (j=0;j<subset_size;j++) {
3589 for (k=j;k<subset_size;k++) {
3590 S [j*subset_size+k] = Sarray [cumarray+j*subset_size+k];
3591 St[j*subset_size+k] = Starray[cumarray+j*subset_size+k];
3592 }
3593 }
3594 } else {
3595 ierr = PetscArraycpy(S,Sarray+cumarray,subset_size*subset_size)((sizeof(*(S)) != sizeof(*(Sarray+cumarray))) || PetscMemcpy(
S,Sarray+cumarray,(subset_size*subset_size)*sizeof(*(S))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3595,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3596 ierr = PetscArraycpy(St,Starray+cumarray,subset_size*subset_size)((sizeof(*(St)) != sizeof(*(Starray+cumarray))) || PetscMemcpy
(St,Starray+cumarray,(subset_size*subset_size)*sizeof(*(St)))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3596,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3597 }
3598 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3598,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3599#if defined(PETSC_USE_COMPLEX)
3600 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3600; 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(3600,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3600,__func__,"/sandbox/petsc/petsc.master/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)
;
3601#else
3602 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3602; 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(3602,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),3602,__func__,"/sandbox/petsc/petsc.master/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)
;
3603#endif
3604 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),3604,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3605 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3605,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3606 B_neigs += B_neigs2;
3607 }
3608 if (B_ierr) {
3609 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),3609,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: illegal value for argument %d"
,-(int)B_ierr)
;
3610 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),3610,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYGVX Lapack routine: %d eigenvalues failed to converge"
,(int)B_ierr)
;
3611 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),3611,__func__,"/sandbox/petsc/petsc.master/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)
;
3612 }
3613 if (pcbddc->dbg_flag) {
3614 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," -> Got %d eigs\n",B_neigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3614,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3615 for (j=0;j<B_neigs;j++) {
3616 if (eigs[j] == 0.0) {
3617 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer," Inf\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3617,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3618 } else {
3619 if (pcbddc->use_deluxe_scaling) {
3620 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),3620,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3621 } else {
3622 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),3622,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3623 }
3624 }
3625 }
3626 }
3627 } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented")return PetscError(((MPI_Comm)0x44000001),3627,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
3628 }
3629 /* change the basis back to the original one */
3630 if (sub_schurs->change) {
3631 Mat change,phi,phit;
3632
3633 if (pcbddc->dbg_flag > 2) {
3634 PetscInt ii;
3635 for (ii=0;ii<B_neigs;ii++) {
3636 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),3636,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3637 for (j=0;j<B_N;j++) {
3638#if defined(PETSC_USE_COMPLEX)
3639 PetscReal r = PetscRealPart(eigv[(ii+eigs_start)*subset_size+j])(eigv[(ii+eigs_start)*subset_size+j]);
3640 PetscReal c = PetscImaginaryPart(eigv[(ii+eigs_start)*subset_size+j])((PetscReal)0);
3641 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),3641,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3642#else
3643 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),3643,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3644#endif
3645 }
3646 }
3647 }
3648 ierr = KSPGetOperators(sub_schurs->change[i],&change,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3648,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3649 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),3649,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3650 ierr = MatMatMult(change,phit,MAT_INITIAL_MATRIX,PETSC_DEFAULT-2,&phi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3650,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3651 ierr = MatCopy(phi,phit,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3651,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3652 ierr = MatDestroy(&phit);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3652,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3653 ierr = MatDestroy(&phi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3653,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3654 }
3655 maxneigs = PetscMax(B_neigs,maxneigs)(((B_neigs)<(maxneigs)) ? (maxneigs) : (B_neigs));
3656 pcbddc->adaptive_constraints_n[i+nv] = B_neigs;
3657 if (B_neigs) {
3658 ierr = PetscArraycpy(pcbddc->adaptive_constraints_data+pcbddc->adaptive_constraints_data_ptr[cum],eigv+eigs_start*subset_size,B_neigs*subset_size)((sizeof(*(pcbddc->adaptive_constraints_data+pcbddc->adaptive_constraints_data_ptr
[cum])) != sizeof(*(eigv+eigs_start*subset_size))) || PetscMemcpy
(pcbddc->adaptive_constraints_data+pcbddc->adaptive_constraints_data_ptr
[cum],eigv+eigs_start*subset_size,(B_neigs*subset_size)*sizeof
(*(pcbddc->adaptive_constraints_data+pcbddc->adaptive_constraints_data_ptr
[cum]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3658,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3659
3660 if (pcbddc->dbg_flag > 1) {
3661 PetscInt ii;
3662 for (ii=0;ii<B_neigs;ii++) {
3663 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),3663,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3664 for (j=0;j<B_N;j++) {
3665#if defined(PETSC_USE_COMPLEX)
3666 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]])
;
3667 PetscReal c = PetscImaginaryPart(pcbddc->adaptive_constraints_data[ii*subset_size+j+pcbddc->adaptive_constraints_data_ptr[cum]])((PetscReal)0);
3668 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),3668,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3669#else
3670 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),3670,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3671#endif
3672 }
3673 }
3674 }
3675 ierr = PetscArraycpy(pcbddc->adaptive_constraints_idxs+pcbddc->adaptive_constraints_idxs_ptr[cum],idxs,subset_size)((sizeof(*(pcbddc->adaptive_constraints_idxs+pcbddc->adaptive_constraints_idxs_ptr
[cum])) != sizeof(*(idxs))) || PetscMemcpy(pcbddc->adaptive_constraints_idxs
+pcbddc->adaptive_constraints_idxs_ptr[cum],idxs,(subset_size
)*sizeof(*(pcbddc->adaptive_constraints_idxs+pcbddc->adaptive_constraints_idxs_ptr
[cum]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3675,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3676 pcbddc->adaptive_constraints_idxs_ptr[cum+1] = pcbddc->adaptive_constraints_idxs_ptr[cum] + subset_size;
3677 pcbddc->adaptive_constraints_data_ptr[cum+1] = pcbddc->adaptive_constraints_data_ptr[cum] + subset_size*B_neigs;
3678 cum++;
3679 }
3680 ierr = ISRestoreIndices(sub_schurs->is_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3680,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3681 /* shift for next computation */
3682 cumarray += subset_size*subset_size;
3683 }
3684 if (pcbddc->dbg_flag) {
3685 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3685,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3686 }
3687
3688 if (mss) {
3689 ierr = MatSeqAIJRestoreArray(sub_schurs->sum_S_Ej_inv_all,&Sarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3689,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3690 ierr = MatSeqAIJRestoreArray(sub_schurs->sum_S_Ej_tilda_all,&Starray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3690,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3691 /* destroy matrices (junk) */
3692 ierr = MatDestroy(&sub_schurs->sum_S_Ej_inv_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3692,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3693 ierr = MatDestroy(&sub_schurs->sum_S_Ej_tilda_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3693,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3694 }
3695 if (allocated_S_St) {
3696 ierr = PetscFree2(S,St)PetscFreeA(2,3696,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(S),&(St))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3696,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3697 }
3698 ierr = PetscFree5(eigv,eigs,work,B_iwork,B_ifail)PetscFreeA(5,3698,__func__,"/sandbox/petsc/petsc.master/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),3698,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3699#if defined(PETSC_USE_COMPLEX)
3700 ierr = PetscFree(rwork)((*PetscTrFree)((void*)(rwork),3700,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((rwork) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3700,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3701#endif
3702 if (pcbddc->dbg_flag) {
3703 PetscInt maxneigs_r;
3704 ierr = MPIU_Allreduce(&maxneigs,&maxneigs_r,1,MPIU_INT,MPI_MAX,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,3704,__func__,"/sandbox/petsc/petsc.master/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),3704,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3705 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),3705,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3706 }
3707 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),3707,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3708 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3709}
3710
3711PetscErrorCode PCBDDCSetUpSolvers(PC pc)
3712{
3713 PetscScalar *coarse_submat_vals;
3714 PetscErrorCode ierr;
3715
3716 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3716; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3717 /* Setup local scatters R_to_B and (optionally) R_to_D */
3718 /* PCBDDCSetUpLocalWorkVectors should be called first! */
3719 ierr = PCBDDCSetUpLocalScatters(pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3719,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3720
3721 /* Setup local neumann solver ksp_R */
3722 /* PCBDDCSetUpLocalScatters should be called first! */
3723 ierr = PCBDDCSetUpLocalSolvers(pc,PETSC_FALSE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3723,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3724
3725 /*
3726 Setup local correction and local part of coarse basis.
3727 Gives back the dense local part of the coarse matrix in column major ordering
3728 */
3729 ierr = PCBDDCSetUpCorrection(pc,&coarse_submat_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3729,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3730
3731 /* Compute total number of coarse nodes and setup coarse solver */
3732 ierr = PCBDDCSetUpCoarseSolver(pc,coarse_submat_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3732,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3733
3734 /* free */
3735 ierr = PetscFree(coarse_submat_vals)((*PetscTrFree)((void*)(coarse_submat_vals),3735,__func__,"/sandbox/petsc/petsc.master/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),3735,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3736 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3737}
3738
3739PetscErrorCode PCBDDCResetCustomization(PC pc)
3740{
3741 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3742 PetscErrorCode ierr;
3743
3744 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3744; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3745 ierr = ISDestroy(&pcbddc->user_primal_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3745,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3746 ierr = ISDestroy(&pcbddc->user_primal_vertices_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3746,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3747 ierr = ISDestroy(&pcbddc->NeumannBoundaries);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3747,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3748 ierr = ISDestroy(&pcbddc->NeumannBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3748,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3749 ierr = ISDestroy(&pcbddc->DirichletBoundaries);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3749,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3750 ierr = MatNullSpaceDestroy(&pcbddc->onearnullspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3750,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3751 ierr = PetscFree(pcbddc->onearnullvecs_state)((*PetscTrFree)((void*)(pcbddc->onearnullvecs_state),3751,
__func__,"/sandbox/petsc/petsc.master/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),3751,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3752 ierr = ISDestroy(&pcbddc->DirichletBoundariesLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3752,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3753 ierr = PCBDDCSetDofsSplitting(pc,0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3753,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3754 ierr = PCBDDCSetDofsSplittingLocal(pc,0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3754,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3755 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3756}
3757
3758PetscErrorCode PCBDDCResetTopography(PC pc)
3759{
3760 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3761 PetscInt i;
3762 PetscErrorCode ierr;
3763
3764 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3764; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3765 ierr = MatDestroy(&pcbddc->nedcG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3765,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3766 ierr = ISDestroy(&pcbddc->nedclocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3766,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3767 ierr = MatDestroy(&pcbddc->discretegradient);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3767,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3768 ierr = MatDestroy(&pcbddc->user_ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3768,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3769 ierr = MatDestroy(&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3769,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3770 ierr = MatDestroy(&pcbddc->switch_static_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3770,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3771 ierr = VecDestroy(&pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3771,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3772 ierr = MatDestroy(&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3772,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3773 ierr = MatDestroy(&pcbddc->divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3773,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3774 ierr = ISDestroy(&pcbddc->divudotp_vl2l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3774,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3775 ierr = PCBDDCGraphDestroy(&pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3775,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3776 for (i=0;i<pcbddc->n_local_subs;i++) {
3777 ierr = ISDestroy(&pcbddc->local_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3777,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3778 }
3779 pcbddc->n_local_subs = 0;
3780 ierr = PetscFree(pcbddc->local_subs)((*PetscTrFree)((void*)(pcbddc->local_subs),3780,__func__,
"/sandbox/petsc/petsc.master/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),3780,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3781 ierr = PCBDDCSubSchursDestroy(&pcbddc->sub_schurs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3781,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3782 pcbddc->graphanalyzed = PETSC_FALSE;
3783 pcbddc->recompute_topography = PETSC_TRUE;
3784 pcbddc->corner_selected = PETSC_FALSE;
3785 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3786}
3787
3788PetscErrorCode PCBDDCResetSolvers(PC pc)
3789{
3790 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3791 PetscErrorCode ierr;
3792
3793 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3793; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3794 ierr = VecDestroy(&pcbddc->coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3794,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3795 if (pcbddc->coarse_phi_B) {
3796 PetscScalar *array;
3797 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3797,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3798 ierr = PetscFree(array)((*PetscTrFree)((void*)(array),3798,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((array) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3798,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3799 }
3800 ierr = MatDestroy(&pcbddc->coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3800,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3801 ierr = MatDestroy(&pcbddc->coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3801,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3802 ierr = MatDestroy(&pcbddc->coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3802,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3803 ierr = MatDestroy(&pcbddc->coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3803,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3804 ierr = VecDestroy(&pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3804,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3805 ierr = VecDestroy(&pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3805,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3806 ierr = MatDestroy(&pcbddc->local_auxmat2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3806,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3807 ierr = MatDestroy(&pcbddc->local_auxmat1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3807,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3808 ierr = VecDestroy(&pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3808,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3809 ierr = VecDestroy(&pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3809,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3810 ierr = ISDestroy(&pcbddc->is_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3810,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3811 ierr = VecScatterDestroy(&pcbddc->R_to_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3811,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3812 ierr = VecScatterDestroy(&pcbddc->R_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3812,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3813 ierr = VecScatterDestroy(&pcbddc->coarse_loc_to_glob);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3813,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3814 ierr = KSPReset(pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3814,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3815 ierr = KSPReset(pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3815,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3816 ierr = KSPReset(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3816,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3817 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3817,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3818 ierr = PetscFree(pcbddc->primal_indices_local_idxs)((*PetscTrFree)((void*)(pcbddc->primal_indices_local_idxs)
,3818,__func__,"/sandbox/petsc/petsc.master/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),3818,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3819 ierr = PetscFree2(pcbddc->local_primal_ref_node,pcbddc->local_primal_ref_mult)PetscFreeA(2,3819,__func__,"/sandbox/petsc/petsc.master/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),3819,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3820 ierr = PetscFree(pcbddc->global_primal_indices)((*PetscTrFree)((void*)(pcbddc->global_primal_indices),3820
,__func__,"/sandbox/petsc/petsc.master/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),3820,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3821 ierr = ISDestroy(&pcbddc->coarse_subassembling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3821,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3822 ierr = MatDestroy(&pcbddc->benign_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3822,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3823 ierr = VecDestroy(&pcbddc->benign_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3823,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3824 ierr = PCBDDCBenignShellMat(pc,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3824,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3825 ierr = MatDestroy(&pcbddc->benign_B0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3825,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3826 ierr = PetscSFDestroy(&pcbddc->benign_sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3826,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3827 if (pcbddc->benign_zerodiag_subs) {
3828 PetscInt i;
3829 for (i=0;i<pcbddc->benign_n;i++) {
3830 ierr = ISDestroy(&pcbddc->benign_zerodiag_subs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3830,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3831 }
3832 ierr = PetscFree(pcbddc->benign_zerodiag_subs)((*PetscTrFree)((void*)(pcbddc->benign_zerodiag_subs),3832
,__func__,"/sandbox/petsc/petsc.master/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),3832,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3833 }
3834 ierr = PetscFree3(pcbddc->benign_p0_lidx,pcbddc->benign_p0_gidx,pcbddc->benign_p0)PetscFreeA(3,3834,__func__,"/sandbox/petsc/petsc.master/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),3834,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3835 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3836}
3837
3838PetscErrorCode PCBDDCSetUpLocalWorkVectors(PC pc)
3839{
3840 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
3841 PC_IS *pcis = (PC_IS*)pc->data;
3842 VecType impVecType;
3843 PetscInt n_constraints,n_R,old_size;
3844 PetscErrorCode ierr;
3845
3846 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3846; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3847 n_constraints = pcbddc->local_primal_size - pcbddc->benign_n - pcbddc->n_vertices;
3848 n_R = pcis->n - pcbddc->n_vertices;
3849 ierr = VecGetType(pcis->vec1_N,&impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3849,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3850 /* local work vectors (try to avoid unneeded work)*/
3851 /* R nodes */
3852 old_size = -1;
3853 if (pcbddc->vec1_R) {
3854 ierr = VecGetSize(pcbddc->vec1_R,&old_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3854,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3855 }
3856 if (n_R != old_size) {
3857 ierr = VecDestroy(&pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3857,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3858 ierr = VecDestroy(&pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3858,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3859 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3859,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3860 ierr = VecSetSizes(pcbddc->vec1_R,PETSC_DECIDE-1,n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3860,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3861 ierr = VecSetType(pcbddc->vec1_R,impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3861,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3862 ierr = VecDuplicate(pcbddc->vec1_R,&pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3862,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3863 }
3864 /* local primal dofs */
3865 old_size = -1;
3866 if (pcbddc->vec1_P) {
3867 ierr = VecGetSize(pcbddc->vec1_P,&old_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3867,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3868 }
3869 if (pcbddc->local_primal_size != old_size) {
3870 ierr = VecDestroy(&pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3870,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3871 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3871,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3872 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),3872,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3873 ierr = VecSetType(pcbddc->vec1_P,impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3873,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3874 }
3875 /* local explicit constraints */
3876 old_size = -1;
3877 if (pcbddc->vec1_C) {
3878 ierr = VecGetSize(pcbddc->vec1_C,&old_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3878,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3879 }
3880 if (n_constraints && n_constraints != old_size) {
3881 ierr = VecDestroy(&pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3881,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3882 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3882,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3883 ierr = VecSetSizes(pcbddc->vec1_C,PETSC_DECIDE-1,n_constraints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3883,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3884 ierr = VecSetType(pcbddc->vec1_C,impVecType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3884,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3885 }
3886 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
3887}
3888
3889PetscErrorCode PCBDDCSetUpCorrection(PC pc, PetscScalar **coarse_submat_vals_n)
3890{
3891 PetscErrorCode ierr;
3892 /* pointers to pcis and pcbddc */
3893 PC_IS* pcis = (PC_IS*)pc->data;
3894 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
3895 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
3896 /* submatrices of local problem */
3897 Mat A_RV,A_VR,A_VV,local_auxmat2_R;
3898 /* submatrices of local coarse problem */
3899 Mat S_VV,S_CV,S_VC,S_CC;
3900 /* working matrices */
3901 Mat C_CR;
3902 /* additional working stuff */
3903 PC pc_R;
3904 Mat F,Brhs = NULL((void*)0);
3905 Vec dummy_vec;
3906 PetscBool isLU,isCHOL,isILU,need_benign_correction,sparserhs;
3907 PetscScalar *coarse_submat_vals; /* TODO: use a PETSc matrix */
3908 PetscScalar *work;
3909 PetscInt *idx_V_B;
3910 PetscInt lda_rhs,n,n_vertices,n_constraints,*p0_lidx_I;
3911 PetscInt i,n_R,n_D,n_B;
3912
3913 /* some shortcuts to scalars */
3914 PetscScalar one=1.0,m_one=-1.0;
3915
3916 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 3916; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3917 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),3917,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Non-symmetric primal basis computation with benign trick not yet implemented"
)
;
3918 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),3918,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3919
3920 /* Set Non-overlapping dimensions */
3921 n_vertices = pcbddc->n_vertices;
3922 n_constraints = pcbddc->local_primal_size - pcbddc->benign_n - n_vertices;
3923 n_B = pcis->n_B;
3924 n_D = pcis->n - n_B;
3925 n_R = pcis->n - n_vertices;
3926
3927 /* vertices in boundary numbering */
3928 ierr = PetscMalloc1(n_vertices,&idx_V_B)PetscMallocA(1,PETSC_FALSE,3928,__func__,"/sandbox/petsc/petsc.master/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),3928,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3929 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),3929,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3930 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),3930,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error in boundary numbering for BDDC vertices! %D != %D"
,n_vertices,i)
;
3931
3932 /* Subdomain contribution (Non-overlapping) to coarse matrix */
3933 ierr = PetscCalloc1(pcbddc->local_primal_size*pcbddc->local_primal_size,&coarse_submat_vals)PetscMallocA(1,PETSC_TRUE,3933,__func__,"/sandbox/petsc/petsc.master/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),3933,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3934 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),3934,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3935 ierr = MatSeqDenseSetLDA(S_VV,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3935,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3936 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),3936,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3937 ierr = MatSeqDenseSetLDA(S_CV,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3937,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3938 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),3938,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3939 ierr = MatSeqDenseSetLDA(S_VC,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3939,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3940 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),3940,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3941 ierr = MatSeqDenseSetLDA(S_CC,pcbddc->local_primal_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3941,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3942
3943 /* determine if can use MatSolve routines instead of calling KSPSolve on ksp_R */
3944 ierr = KSPGetPC(pcbddc->ksp_R,&pc_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3944,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3945 ierr = PCSetUp(pc_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3945,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3946 ierr = PetscObjectTypeCompare((PetscObject)pc_R,PCLU"lu",&isLU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3946,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3947 ierr = PetscObjectTypeCompare((PetscObject)pc_R,PCILU"ilu",&isILU);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3947,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3948 ierr = PetscObjectTypeCompare((PetscObject)pc_R,PCCHOLESKY"cholesky",&isCHOL);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3948,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3949 lda_rhs = n_R;
3950 need_benign_correction = PETSC_FALSE;
3951 if (isLU || isILU || isCHOL) {
3952 ierr = PCFactorGetMatrix(pc_R,&F);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3952,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3953 } else if (sub_schurs && sub_schurs->reuse_solver) {
3954 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
3955 MatFactorType type;
3956
3957 F = reuse_solver->F;
3958 ierr = MatGetFactorType(F,&type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3958,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3959 if (type == MAT_FACTOR_CHOLESKY) isCHOL = PETSC_TRUE;
3960 ierr = MatGetSize(F,&lda_rhs,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3960,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3961 need_benign_correction = (PetscBool)(!!reuse_solver->benign_n);
3962 } else {
3963 F = NULL((void*)0);
3964 }
3965
3966 /* determine if we can use a sparse right-hand side */
3967 sparserhs = PETSC_FALSE;
3968 if (F) {
3969 MatSolverType solver;
3970
3971 ierr = MatFactorGetSolverType(F,&solver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3971,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3972 ierr = PetscStrcmp(solver,MATSOLVERMUMPS"mumps",&sparserhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3972,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3973 }
3974
3975 /* allocate workspace */
3976 n = 0;
3977 if (n_constraints) {
3978 n += lda_rhs*n_constraints;
3979 }
3980 if (n_vertices) {
3981 n = PetscMax(2*lda_rhs*n_vertices,n)(((2*lda_rhs*n_vertices)<(n)) ? (n) : (2*lda_rhs*n_vertices
))
;
3982 n = PetscMax((lda_rhs+n_B)*n_vertices,n)((((lda_rhs+n_B)*n_vertices)<(n)) ? (n) : ((lda_rhs+n_B)*n_vertices
))
;
3983 }
3984 if (!pcbddc->symmetric_primal) {
3985 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))
;
3986 }
3987 ierr = PetscMalloc1(n,&work)PetscMallocA(1,PETSC_FALSE,3987,__func__,"/sandbox/petsc/petsc.master/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),3987,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3988
3989 /* create dummy vector to modify rhs and sol of MatMatSolve (work array will never be used) */
3990 dummy_vec = NULL((void*)0);
3991 if (need_benign_correction && lda_rhs != n_R && F) {
3992 ierr = VecCreate(PetscObjectComm((PetscObject)pcis->vec1_N),&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3992,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3993 ierr = VecSetSizes(dummy_vec,lda_rhs,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3993,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3994 ierr = VecSetType(dummy_vec,((PetscObject)pcis->vec1_N)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3994,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3995 }
3996
3997 /* Precompute stuffs needed for preprocessing and application of BDDC*/
3998 if (n_constraints) {
3999 Mat M3,C_B;
4000 IS is_aux;
4001 PetscScalar *array,*array2;
4002
4003 ierr = MatDestroy(&pcbddc->local_auxmat1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4003,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4004 ierr = MatDestroy(&pcbddc->local_auxmat2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4004,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4005
4006 /* Extract constraints on R nodes: C_{CR} */
4007 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),4007,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4008 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),4008,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4009 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),4009,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4010
4011 /* Assemble local_auxmat2_R = (- A_{RR}^{-1} C^T_{CR}) needed by BDDC setup */
4012 /* Assemble pcbddc->local_auxmat2 = R_to_B (- A_{RR}^{-1} C^T_{CR}) needed by BDDC application */
4013 if (!sparserhs) {
4014 ierr = PetscArrayzero(work,lda_rhs*n_constraints)PetscMemzero(work,(lda_rhs*n_constraints)*sizeof(*(work)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4014,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4015 for (i=0;i<n_constraints;i++) {
4016 const PetscScalar *row_cmat_values;
4017 const PetscInt *row_cmat_indices;
4018 PetscInt size_of_constraint,j;
4019
4020 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),4020,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4021 for (j=0;j<size_of_constraint;j++) {
4022 work[row_cmat_indices[j]+i*lda_rhs] = -row_cmat_values[j];
4023 }
4024 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),4024,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4025 }
4026 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),4026,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4027 } else {
4028 Mat tC_CR;
4029
4030 ierr = MatScale(C_CR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4030,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4031 if (lda_rhs != n_R) {
4032 PetscScalar *aa;
4033 PetscInt r,*ii,*jj;
4034 PetscBool done;
4035
4036 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),4036,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4037 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"GetRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4037,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"GetRowIJ failed")
;
4038 ierr = MatSeqAIJGetArray(C_CR,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4038,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4039 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),4039,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4040 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),4040,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4041 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"RestoreRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4041,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"RestoreRowIJ failed")
;
4042 } else {
4043 ierr = PetscObjectReference((PetscObject)C_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4043,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4044 tC_CR = C_CR;
4045 }
4046 ierr = MatCreateTranspose(tC_CR,&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4046,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4047 ierr = MatDestroy(&tC_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4047,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4048 }
4049 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),4049,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4050 if (F) {
4051 if (need_benign_correction) {
4052 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4053
4054 /* rhs is already zero on interior dofs, no need to change the rhs */
4055 ierr = PetscArrayzero(reuse_solver->benign_save_vals,pcbddc->benign_n)PetscMemzero(reuse_solver->benign_save_vals,(pcbddc->benign_n
)*sizeof(*(reuse_solver->benign_save_vals)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4055,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4056 }
4057 ierr = MatMatSolve(F,Brhs,local_auxmat2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4057,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4058 if (need_benign_correction) {
4059 PetscScalar *marr;
4060 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4061
4062 ierr = MatDenseGetArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4062,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4063 if (lda_rhs != n_R) {
4064 for (i=0;i<n_constraints;i++) {
4065 ierr = VecPlaceArray(dummy_vec,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4065,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4066 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),4066,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4067 ierr = VecResetArray(dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4067,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4068 }
4069 } else {
4070 for (i=0;i<n_constraints;i++) {
4071 ierr = VecPlaceArray(pcbddc->vec1_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4071,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4072 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),4072,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4073 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4073,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4074 }
4075 }
4076 ierr = MatDenseRestoreArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4076,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4077 }
4078 } else {
4079 PetscScalar *marr;
4080
4081 ierr = MatDenseGetArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4081,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4082 for (i=0;i<n_constraints;i++) {
4083 ierr = VecPlaceArray(pcbddc->vec1_R,work+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4083,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4084 ierr = VecPlaceArray(pcbddc->vec2_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4084,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4085 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4085,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4086 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4086,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4087 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4087,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4088 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4088,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4089 }
4090 ierr = MatDenseRestoreArray(local_auxmat2_R,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4090,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4091 }
4092 if (sparserhs) {
4093 ierr = MatScale(C_CR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4093,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4094 }
4095 ierr = MatDestroy(&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4095,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4096 if (!pcbddc->switch_static) {
4097 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),4097,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4098 ierr = MatDenseGetArray(pcbddc->local_auxmat2,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4098,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4099 ierr = MatDenseGetArray(local_auxmat2_R,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4099,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4100 for (i=0;i<n_constraints;i++) {
4101 ierr = VecPlaceArray(pcbddc->vec1_R,array2+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4101,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4102 ierr = VecPlaceArray(pcis->vec1_B,array+i*n_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4102,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4103 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),4103,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4104 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),4104,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4105 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4105,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4106 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4106,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4107 }
4108 ierr = MatDenseRestoreArray(local_auxmat2_R,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4108,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4109 ierr = MatDenseRestoreArray(pcbddc->local_auxmat2,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4109,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4110 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),4110,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4111 } else {
4112 if (lda_rhs != n_R) {
4113 IS dummy;
4114
4115 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),4115,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4116 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),4116,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4117 ierr = ISDestroy(&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4117,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4118 } else {
4119 ierr = PetscObjectReference((PetscObject)local_auxmat2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4119,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4120 pcbddc->local_auxmat2 = local_auxmat2_R;
4121 }
4122 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),4122,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4123 }
4124 ierr = ISDestroy(&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4124,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4125 /* Assemble explicitly S_CC = ( C_{CR} A_{RR}^{-1} C^T_{CR} )^{-1} */
4126 ierr = MatScale(M3,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4126,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4127 if (isCHOL) {
4128 ierr = MatCholeskyFactor(M3,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4128,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4129 } else {
4130 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),4130,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4131 }
4132 ierr = MatSeqDenseInvertFactors_Private(M3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4132,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4133 /* Assemble local_auxmat1 = S_CC*C_{CB} needed by BDDC application in KSP and in preproc */
4134 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),4134,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4135 ierr = MatDestroy(&C_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4135,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4136 ierr = MatCopy(M3,S_CC,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4136,__func__,"/sandbox/petsc/petsc.master/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 */
4137 ierr = MatDestroy(&M3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4137,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4138 }
4139
4140 /* Get submatrices from subdomain matrix */
4141 if (n_vertices) {
4142 IS is_aux;
4143 PetscBool isseqaij;
4144
4145 if (sub_schurs && sub_schurs->reuse_solver) { /* is_R_local is not sorted, ISComplement doesn't like it */
4146 IS tis;
4147
4148 ierr = ISDuplicate(pcbddc->is_R_local,&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4148,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4149 ierr = ISSort(tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4149,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4150 ierr = ISComplement(tis,0,pcis->n,&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4150,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4151 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4151,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4152 } else {
4153 ierr = ISComplement(pcbddc->is_R_local,0,pcis->n,&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4153,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4154 }
4155 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),4155,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4156 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),4156,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4157 ierr = PetscObjectTypeCompare((PetscObject)A_VR,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4157,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4158 if (!isseqaij) { /* MatMatMult(A_VR,A_RRmA_RV) below will raise an error */
4159 ierr = MatConvert(A_VR,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4159,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4160 }
4161 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),4161,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4162 ierr = ISDestroy(&is_aux);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4162,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4163 }
4164
4165 /* Matrix of coarse basis functions (local) */
4166 if (pcbddc->coarse_phi_B) {
4167 PetscInt on_B,on_primal,on_D=n_D;
4168 if (pcbddc->coarse_phi_D) {
4169 ierr = MatGetSize(pcbddc->coarse_phi_D,&on_D,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4169,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4170 }
4171 ierr = MatGetSize(pcbddc->coarse_phi_B,&on_B,&on_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4171,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4172 if (on_B != n_B || on_primal != pcbddc->local_primal_size || on_D != n_D) {
4173 PetscScalar *marray;
4174
4175 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4175,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4176 ierr = PetscFree(marray)((*PetscTrFree)((void*)(marray),4176,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((marray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4176,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4177 ierr = MatDestroy(&pcbddc->coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4177,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4178 ierr = MatDestroy(&pcbddc->coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4178,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4179 ierr = MatDestroy(&pcbddc->coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4179,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4180 ierr = MatDestroy(&pcbddc->coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4180,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4181 }
4182 }
4183
4184 if (!pcbddc->coarse_phi_B) {
4185 PetscScalar *marr;
4186
4187 /* memory size */
4188 n = n_B*pcbddc->local_primal_size;
4189 if (pcbddc->switch_static || pcbddc->dbg_flag) n += n_D*pcbddc->local_primal_size;
4190 if (!pcbddc->symmetric_primal) n *= 2;
4191 ierr = PetscCalloc1(n,&marr)PetscMallocA(1,PETSC_TRUE,4191,__func__,"/sandbox/petsc/petsc.master/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),4191,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4192 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),4192,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4193 marr += n_B*pcbddc->local_primal_size;
4194 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4195 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),4195,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4196 marr += n_D*pcbddc->local_primal_size;
4197 }
4198 if (!pcbddc->symmetric_primal) {
4199 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),4199,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4200 marr += n_B*pcbddc->local_primal_size;
4201 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4202 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),4202,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4203 }
4204 } else {
4205 ierr = PetscObjectReference((PetscObject)pcbddc->coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4205,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4206 pcbddc->coarse_psi_B = pcbddc->coarse_phi_B;
4207 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4208 ierr = PetscObjectReference((PetscObject)pcbddc->coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4209 pcbddc->coarse_psi_D = pcbddc->coarse_phi_D;
4210 }
4211 }
4212 }
4213
4214 /* We are now ready to evaluate coarse basis functions and subdomain contribution to coarse problem */
4215 p0_lidx_I = NULL((void*)0);
4216 if (pcbddc->benign_n && (pcbddc->switch_static || pcbddc->dbg_flag)) {
4217 const PetscInt *idxs;
4218
4219 ierr = ISGetIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4219,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4220 ierr = PetscMalloc1(pcbddc->benign_n,&p0_lidx_I)PetscMallocA(1,PETSC_FALSE,4220,__func__,"/sandbox/petsc/petsc.master/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),4220,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4221 for (i=0;i<pcbddc->benign_n;i++) {
4222 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),4222,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4223 }
4224 ierr = ISRestoreIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4224,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4225 }
4226
4227 /* vertices */
4228 if (n_vertices) {
4229 PetscBool restoreavr = PETSC_FALSE;
4230
4231 ierr = MatConvert(A_VV,MATDENSE"dense",MAT_INPLACE_MATRIX,&A_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4231,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4232
4233 if (n_R) {
4234 Mat A_RRmA_RV,A_RV_bcorr=NULL((void*)0),S_VVt; /* S_VVt with LDA=N */
4235 PetscBLASInt B_N,B_one = 1;
4236 const PetscScalar *x;
4237 PetscScalar *y;
4238
4239 ierr = MatScale(A_RV,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4239,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4240 if (need_benign_correction) {
4241 ISLocalToGlobalMapping RtoN;
4242 IS is_p0;
4243 PetscInt *idxs_p0,n;
4244
4245 ierr = PetscMalloc1(pcbddc->benign_n,&idxs_p0)PetscMallocA(1,PETSC_FALSE,4245,__func__,"/sandbox/petsc/petsc.master/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),4245,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4246 ierr = ISLocalToGlobalMappingCreateIS(pcbddc->is_R_local,&RtoN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4246,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4247 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),4247,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4248 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),4248,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error in R numbering for benign p0! %D != %D"
,n,pcbddc->benign_n)
;
4249 ierr = ISLocalToGlobalMappingDestroy(&RtoN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4249,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4250 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),4250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4251 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),4251,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4252 ierr = ISDestroy(&is_p0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4252,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4253 }
4254
4255 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),4255,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4256 if (!sparserhs || need_benign_correction) {
4257 if (lda_rhs == n_R) {
4258 ierr = MatConvert(A_RV,MATDENSE"dense",MAT_INPLACE_MATRIX,&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4258,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4259 } else {
4260 PetscScalar *av,*array;
4261 const PetscInt *xadj,*adjncy;
4262 PetscInt n;
4263 PetscBool flg_row;
4264
4265 array = work+lda_rhs*n_vertices;
4266 ierr = PetscArrayzero(array,lda_rhs*n_vertices)PetscMemzero(array,(lda_rhs*n_vertices)*sizeof(*(array)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4266,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4267 ierr = MatConvert(A_RV,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4267,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4268 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),4268,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4269 ierr = MatSeqAIJGetArray(A_RV,&av);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4269,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4270 for (i=0;i<n;i++) {
4271 PetscInt j;
4272 for (j=xadj[i];j<xadj[i+1];j++) array[lda_rhs*adjncy[j]+i] = av[j];
4273 }
4274 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),4274,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4275 ierr = MatDestroy(&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4275,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4276 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),4276,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4277 }
4278 if (need_benign_correction) {
4279 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4280 PetscScalar *marr;
4281
4282 ierr = MatDenseGetArray(A_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4282,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4283 /* need \Phi^T A_RV = (I+L)A_RV, L given by
4284
4285 | 0 0 0 | (V)
4286 L = | 0 0 -1 | (P-p0)
4287 | 0 0 -1 | (p0)
4288
4289 */
4290 for (i=0;i<reuse_solver->benign_n;i++) {
4291 const PetscScalar *vals;
4292 const PetscInt *idxs,*idxs_zero;
4293 PetscInt n,j,nz;
4294
4295 ierr = ISGetLocalSize(reuse_solver->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4295,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4296 ierr = ISGetIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4296,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4297 ierr = MatGetRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4297,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4298 for (j=0;j<n;j++) {
4299 PetscScalar val = vals[j];
4300 PetscInt k,col = idxs[j];
4301 for (k=0;k<nz;k++) marr[idxs_zero[k]+lda_rhs*col] -= val;
4302 }
4303 ierr = MatRestoreRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4303,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4304 ierr = ISRestoreIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4304,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4305 }
4306 ierr = MatDenseRestoreArray(A_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4306,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4307 }
4308 ierr = PetscObjectReference((PetscObject)A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4308,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4309 Brhs = A_RV;
4310 } else {
4311 Mat tA_RVT,A_RVT;
4312
4313 if (!pcbddc->symmetric_primal) {
4314 /* A_RV already scaled by -1 */
4315 ierr = MatTranspose(A_RV,MAT_INITIAL_MATRIX,&A_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4315,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4316 } else {
4317 restoreavr = PETSC_TRUE;
4318 ierr = MatScale(A_VR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4318,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4319 ierr = PetscObjectReference((PetscObject)A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4319,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4320 A_RVT = A_VR;
4321 }
4322 if (lda_rhs != n_R) {
4323 PetscScalar *aa;
4324 PetscInt r,*ii,*jj;
4325 PetscBool done;
4326
4327 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),4327,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4328 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"GetRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4328,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"GetRowIJ failed")
;
4329 ierr = MatSeqAIJGetArray(A_RVT,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4329,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4330 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),4330,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4331 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),4331,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4332 if (!done) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"RestoreRowIJ failed")return PetscError(((MPI_Comm)0x44000001),4332,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"RestoreRowIJ failed")
;
4333 } else {
4334 ierr = PetscObjectReference((PetscObject)A_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4334,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4335 tA_RVT = A_RVT;
4336 }
4337 ierr = MatCreateTranspose(tA_RVT,&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4337,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4338 ierr = MatDestroy(&tA_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4338,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4339 ierr = MatDestroy(&A_RVT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4339,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4340 }
4341 if (F) {
4342 /* need to correct the rhs */
4343 if (need_benign_correction) {
4344 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4345 PetscScalar *marr;
4346
4347 ierr = MatDenseGetArray(Brhs,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4347,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4348 if (lda_rhs != n_R) {
4349 for (i=0;i<n_vertices;i++) {
4350 ierr = VecPlaceArray(dummy_vec,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4350,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4351 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),4351,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4352 ierr = VecResetArray(dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4352,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4353 }
4354 } else {
4355 for (i=0;i<n_vertices;i++) {
4356 ierr = VecPlaceArray(pcbddc->vec1_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4356,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4357 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),4357,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4358 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4358,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4359 }
4360 }
4361 ierr = MatDenseRestoreArray(Brhs,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4361,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4362 }
4363 ierr = MatMatSolve(F,Brhs,A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4363,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4364 if (restoreavr) {
4365 ierr = MatScale(A_VR,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4365,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4366 }
4367 /* need to correct the solution */
4368 if (need_benign_correction) {
4369 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4370 PetscScalar *marr;
4371
4372 ierr = MatDenseGetArray(A_RRmA_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4373 if (lda_rhs != n_R) {
4374 for (i=0;i<n_vertices;i++) {
4375 ierr = VecPlaceArray(dummy_vec,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4375,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4376 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),4376,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4377 ierr = VecResetArray(dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4377,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4378 }
4379 } else {
4380 for (i=0;i<n_vertices;i++) {
4381 ierr = VecPlaceArray(pcbddc->vec1_R,marr+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4381,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4382 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),4382,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4383 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4383,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4384 }
4385 }
4386 ierr = MatDenseRestoreArray(A_RRmA_RV,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4386,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4387 }
4388 } else {
4389 ierr = MatDenseGetArray(Brhs,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4389,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4390 for (i=0;i<n_vertices;i++) {
4391 ierr = VecPlaceArray(pcbddc->vec1_R,y+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4391,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4392 ierr = VecPlaceArray(pcbddc->vec2_R,work+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4392,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4393 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4393,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4394 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4394,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4395 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4395,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4396 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4396,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4397 }
4398 ierr = MatDenseRestoreArray(Brhs,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4398,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4399 }
4400 ierr = MatDestroy(&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4400,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4401 ierr = MatDestroy(&Brhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4401,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4402 /* S_VV and S_CV */
4403 if (n_constraints) {
4404 Mat B;
4405
4406 ierr = PetscArrayzero(work+lda_rhs*n_vertices,n_B*n_vertices)PetscMemzero(work+lda_rhs*n_vertices,(n_B*n_vertices)*sizeof(
*(work+lda_rhs*n_vertices)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4406,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4407 for (i=0;i<n_vertices;i++) {
4408 ierr = VecPlaceArray(pcbddc->vec1_R,work+i*lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4408,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4409 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),4409,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4410 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),4410,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4411 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),4411,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4412 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4412,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4413 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4413,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4414 }
4415 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),4415,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4416 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),4416,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4417 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4417,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4418 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),4418,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4419 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),4419,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4420 ierr = MatScale(S_CV,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4420,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4421 ierr = PetscBLASIntCast(lda_rhs*n_vertices,&B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4421,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4422 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 4422; 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
(4422,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),4422,__func__,"/sandbox/petsc/petsc.master/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)
;
4423 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4423,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4424 }
4425 if (lda_rhs != n_R) {
4426 ierr = MatDestroy(&A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4426,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4427 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),4427,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4428 ierr = MatSeqDenseSetLDA(A_RRmA_RV,lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4428,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4429 }
4430 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),4430,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4431 /* need A_VR * \Phi * A_RRmA_RV = A_VR * (I+L)^T * A_RRmA_RV, L given as before */
4432 if (need_benign_correction) {
4433 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
4434 PetscScalar *marr,*sums;
4435
4436 ierr = PetscMalloc1(n_vertices,&sums)PetscMallocA(1,PETSC_FALSE,4436,__func__,"/sandbox/petsc/petsc.master/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),4436,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4437 ierr = MatDenseGetArray(S_VVt,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4437,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4438 for (i=0;i<reuse_solver->benign_n;i++) {
4439 const PetscScalar *vals;
4440 const PetscInt *idxs,*idxs_zero;
4441 PetscInt n,j,nz;
4442
4443 ierr = ISGetLocalSize(reuse_solver->benign_zerodiag_subs[i],&nz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4443,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4444 ierr = ISGetIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4444,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4445 for (j=0;j<n_vertices;j++) {
4446 PetscInt k;
4447 sums[j] = 0.;
4448 for (k=0;k<nz;k++) sums[j] += work[idxs_zero[k]+j*lda_rhs];
4449 }
4450 ierr = MatGetRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4450,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4451 for (j=0;j<n;j++) {
4452 PetscScalar val = vals[j];
4453 PetscInt k;
4454 for (k=0;k<n_vertices;k++) {
4455 marr[idxs[j]+k*n_vertices] += val*sums[k];
4456 }
4457 }
4458 ierr = MatRestoreRow(A_RV_bcorr,i,&n,&idxs,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4458,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4459 ierr = ISRestoreIndices(reuse_solver->benign_zerodiag_subs[i],&idxs_zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4459,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4460 }
4461 ierr = PetscFree(sums)((*PetscTrFree)((void*)(sums),4461,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((sums) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4461,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4462 ierr = MatDenseRestoreArray(S_VVt,&marr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4462,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4463 ierr = MatDestroy(&A_RV_bcorr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4463,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4464 }
4465 ierr = MatDestroy(&A_RRmA_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4465,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4466 ierr = PetscBLASIntCast(n_vertices*n_vertices,&B_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4466,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4467 ierr = MatDenseGetArrayRead(A_VV,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4467,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4468 ierr = MatDenseGetArray(S_VVt,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4468,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4469 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 4469; 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(4469,__func__,
"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),4469,__func__,"/sandbox/petsc/petsc.master/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)
;
4470 ierr = MatDenseRestoreArrayRead(A_VV,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4470,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4471 ierr = MatDenseRestoreArray(S_VVt,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4471,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4472 ierr = MatCopy(S_VVt,S_VV,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4472,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4473 ierr = MatDestroy(&S_VVt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4473,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4474 } else {
4475 ierr = MatCopy(A_VV,S_VV,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4475,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4476 }
4477 ierr = MatDestroy(&A_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4477,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4478
4479 /* coarse basis functions */
4480 for (i=0;i<n_vertices;i++) {
4481 PetscScalar *y;
4482
4483 ierr = VecPlaceArray(pcbddc->vec1_R,work+lda_rhs*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4483,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4484 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4484,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4485 ierr = VecPlaceArray(pcis->vec1_B,y+n_B*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4485,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4486 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),4486,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4487 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),4487,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4488 y[n_B*i+idx_V_B[i]] = 1.0;
4489 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4489,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4490 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4490,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4491
4492 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4493 PetscInt j;
4494
4495 ierr = MatDenseGetArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4495,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4496 ierr = VecPlaceArray(pcis->vec1_D,y+n_D*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4496,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4497 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),4497,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4498 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),4498,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4499 ierr = VecResetArray(pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4499,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4500 for (j=0;j<pcbddc->benign_n;j++) y[n_D*i+p0_lidx_I[j]] = 0.0;
4501 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4501,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4502 }
4503 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4503,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4504 }
4505 /* if n_R == 0 the object is not destroyed */
4506 ierr = MatDestroy(&A_RV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4506,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4507 }
4508 ierr = VecDestroy(&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4508,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4509
4510 if (n_constraints) {
4511 Mat B;
4512
4513 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),4513,__func__,"/sandbox/petsc/petsc.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4515 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),4515,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4516 ierr = MatScale(S_CC,m_one);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4516,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4517 if (n_vertices) {
4518 if (isCHOL || need_benign_correction) { /* if we can solve the interior problem with cholesky, we should also be fine with transposing here */
4519 ierr = MatTranspose(S_CV,MAT_REUSE_MATRIX,&S_VC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4519,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4520 } else {
4521 Mat S_VCt;
4522
4523 if (lda_rhs != n_R) {
4524 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4524,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4525 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),4525,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4526 ierr = MatSeqDenseSetLDA(B,lda_rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4526,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4527 }
4528 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),4528,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4529 ierr = MatCopy(S_VCt,S_VC,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4529,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4530 ierr = MatDestroy(&S_VCt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4530,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4531 }
4532 }
4533 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4533,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4534 /* coarse basis functions */
4535 for (i=0;i<n_constraints;i++) {
4536 PetscScalar *y;
4537
4538 ierr = VecPlaceArray(pcbddc->vec1_R,work+lda_rhs*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4538,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4539 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4539,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4540 ierr = VecPlaceArray(pcis->vec1_B,y+n_B*(i+n_vertices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4540,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4541 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),4541,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4542 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),4542,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4543 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4543,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4544 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4544,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4545 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4546 PetscInt j;
4547
4548 ierr = MatDenseGetArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4548,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4549 ierr = VecPlaceArray(pcis->vec1_D,y+n_D*(i+n_vertices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4549,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4550 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),4550,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4551 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),4551,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4552 ierr = VecResetArray(pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4552,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4553 for (j=0;j<pcbddc->benign_n;j++) y[n_D*i+p0_lidx_I[j]] = 0.0;
4554 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4554,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4555 }
4556 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4556,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4557 }
4558 }
4559 if (n_constraints) {
4560 ierr = MatDestroy(&local_auxmat2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4560,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4561 }
4562 ierr = PetscFree(p0_lidx_I)((*PetscTrFree)((void*)(p0_lidx_I),4562,__func__,"/sandbox/petsc/petsc.master/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),4562,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4563
4564 /* coarse matrix entries relative to B_0 */
4565 if (pcbddc->benign_n) {
4566 Mat B0_B,B0_BPHI;
4567 IS is_dummy;
4568 const PetscScalar *data;
4569 PetscInt j;
4570
4571 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),4571,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4572 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),4572,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4573 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4573,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4574 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),4574,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4575 ierr = MatConvert(B0_BPHI,MATSEQDENSE"seqdense",MAT_INPLACE_MATRIX,&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4575,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4576 ierr = MatDenseGetArrayRead(B0_BPHI,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4576,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4577 for (j=0;j<pcbddc->benign_n;j++) {
4578 PetscInt primal_idx = pcbddc->local_primal_size - pcbddc->benign_n + j;
4579 for (i=0;i<pcbddc->local_primal_size;i++) {
4580 coarse_submat_vals[primal_idx*pcbddc->local_primal_size+i] = data[i*pcbddc->benign_n+j];
4581 coarse_submat_vals[i*pcbddc->local_primal_size+primal_idx] = data[i*pcbddc->benign_n+j];
4582 }
4583 }
4584 ierr = MatDenseRestoreArrayRead(B0_BPHI,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4584,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4585 ierr = MatDestroy(&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4585,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4586 ierr = MatDestroy(&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4586,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4587 }
4588
4589 /* compute other basis functions for non-symmetric problems */
4590 if (!pcbddc->symmetric_primal) {
4591 Mat B_V=NULL((void*)0),B_C=NULL((void*)0);
4592 PetscScalar *marray;
4593
4594 if (n_constraints) {
4595 Mat S_CCT,C_CRT;
4596
4597 ierr = MatTranspose(C_CR,MAT_INITIAL_MATRIX,&C_CRT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4597,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4598 ierr = MatTranspose(S_CC,MAT_INITIAL_MATRIX,&S_CCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4598,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4599 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),4599,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4600 ierr = MatDestroy(&S_CCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4600,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4601 if (n_vertices) {
4602 Mat S_VCT;
4603
4604 ierr = MatTranspose(S_VC,MAT_INITIAL_MATRIX,&S_VCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4604,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4605 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),4605,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4606 ierr = MatDestroy(&S_VCT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4606,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4607 }
4608 ierr = MatDestroy(&C_CRT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4608,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4609 } else {
4610 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),4610,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4611 }
4612 if (n_vertices && n_R) {
4613 PetscScalar *av,*marray;
4614 const PetscInt *xadj,*adjncy;
4615 PetscInt n;
4616 PetscBool flg_row;
4617
4618 /* B_V = B_V - A_VR^T */
4619 ierr = MatConvert(A_VR,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4619,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4620 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),4620,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4621 ierr = MatSeqAIJGetArray(A_VR,&av);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4621,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4622 ierr = MatDenseGetArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4622,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4623 for (i=0;i<n;i++) {
4624 PetscInt j;
4625 for (j=xadj[i];j<xadj[i+1];j++) marray[i*n_R + adjncy[j]] -= av[j];
4626 }
4627 ierr = MatDenseRestoreArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4627,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4628 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),4628,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4629 ierr = MatDestroy(&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4629,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4630 }
4631
4632 /* currently there's no support for MatTransposeMatSolve(F,B,X) */
4633 if (n_vertices) {
4634 ierr = MatDenseGetArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4634,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4635 for (i=0;i<n_vertices;i++) {
4636 ierr = VecPlaceArray(pcbddc->vec1_R,marray+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4636,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4637 ierr = VecPlaceArray(pcbddc->vec2_R,work+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4637,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4638 ierr = KSPSolveTranspose(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4638,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4639 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4639,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4640 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4640,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4641 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4641,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4642 }
4643 ierr = MatDenseRestoreArray(B_V,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4643,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4644 }
4645 if (B_C) {
4646 ierr = MatDenseGetArray(B_C,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4646,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4647 for (i=n_vertices;i<n_constraints+n_vertices;i++) {
4648 ierr = VecPlaceArray(pcbddc->vec1_R,marray+(i-n_vertices)*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4648,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4649 ierr = VecPlaceArray(pcbddc->vec2_R,work+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4649,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4650 ierr = KSPSolveTranspose(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4650,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4651 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4651,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4652 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4652,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4653 ierr = VecResetArray(pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4653,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4654 }
4655 ierr = MatDenseRestoreArray(B_C,&marray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4655,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4656 }
4657 /* coarse basis functions */
4658 for (i=0;i<pcbddc->local_primal_size;i++) {
4659 PetscScalar *y;
4660
4661 ierr = VecPlaceArray(pcbddc->vec1_R,work+i*n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4661,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4662 ierr = MatDenseGetArray(pcbddc->coarse_psi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4662,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4663 ierr = VecPlaceArray(pcis->vec1_B,y+n_B*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4663,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4664 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),4664,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4665 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),4665,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4666 if (i<n_vertices) {
4667 y[n_B*i+idx_V_B[i]] = 1.0;
4668 }
4669 ierr = MatDenseRestoreArray(pcbddc->coarse_psi_B,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4669,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4670 ierr = VecResetArray(pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4670,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4671
4672 if (pcbddc->switch_static || pcbddc->dbg_flag) {
4673 ierr = MatDenseGetArray(pcbddc->coarse_psi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4673,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4674 ierr = VecPlaceArray(pcis->vec1_D,y+n_D*i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4674,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4675 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),4675,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4676 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),4676,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4677 ierr = VecResetArray(pcis->vec1_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4677,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4678 ierr = MatDenseRestoreArray(pcbddc->coarse_psi_D,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4678,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4679 }
4680 ierr = VecResetArray(pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4680,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4681 }
4682 ierr = MatDestroy(&B_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4683 ierr = MatDestroy(&B_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4683,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4684 }
4685
4686 /* free memory */
4687 ierr = PetscFree(idx_V_B)((*PetscTrFree)((void*)(idx_V_B),4687,__func__,"/sandbox/petsc/petsc.master/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),4687,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4688 ierr = MatDestroy(&S_VV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4688,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4689 ierr = MatDestroy(&S_CV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4689,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4690 ierr = MatDestroy(&S_VC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4690,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4691 ierr = MatDestroy(&S_CC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4691,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4692 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),4692,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4692,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4693 if (n_vertices) {
4694 ierr = MatDestroy(&A_VR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4694,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4695 }
4696 if (n_constraints) {
4697 ierr = MatDestroy(&C_CR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4697,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4698 }
4699 /* Checking coarse_sub_mat and coarse basis functios */
4700 /* Symmetric case : It should be \Phi^{(j)^T} A^{(j)} \Phi^{(j)}=coarse_sub_mat */
4701 /* Non-symmetric case : It should be \Psi^{(j)^T} A^{(j)} \Phi^{(j)}=coarse_sub_mat */
4702 if (pcbddc->dbg_flag) {
4703 Mat coarse_sub_mat;
4704 Mat AUXMAT,TM1,TM2,TM3,TM4;
4705 Mat coarse_phi_D,coarse_phi_B;
4706 Mat coarse_psi_D,coarse_psi_B;
4707 Mat A_II,A_BB,A_IB,A_BI;
4708 Mat C_B,CPHI;
4709 IS is_dummy;
4710 Vec mones;
4711 MatType checkmattype=MATSEQAIJ"seqaij";
4712 PetscReal real_value;
4713
4714 if (pcbddc->benign_n && !pcbddc->benign_change_explicit) {
4715 Mat A;
4716 ierr = PCBDDCBenignProject(pc,NULL((void*)0),NULL((void*)0),&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4716,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4717 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),4717,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4718 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),4718,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4719 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),4719,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4720 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),4720,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4721 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4721,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4722 } else {
4723 ierr = MatConvert(pcis->A_II,checkmattype,MAT_INITIAL_MATRIX,&A_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4723,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4724 ierr = MatConvert(pcis->A_IB,checkmattype,MAT_INITIAL_MATRIX,&A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4724,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4725 ierr = MatConvert(pcis->A_BI,checkmattype,MAT_INITIAL_MATRIX,&A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4725,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4726 ierr = MatConvert(pcis->A_BB,checkmattype,MAT_INITIAL_MATRIX,&A_BB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4726,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4727 }
4728 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),4728,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4729 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),4729,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4730 if (!pcbddc->symmetric_primal) {
4731 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),4731,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4732 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),4732,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4733 }
4734 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),4734,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4735
4736 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4736,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4737 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),4737,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4738 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4738,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4739 if (!pcbddc->symmetric_primal) {
4740 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),4740,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4741 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),4741,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4742 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4742,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4743 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),4743,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4744 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),4744,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4745 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4745,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4746 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),4746,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4747 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),4747,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4748 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4748,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4749 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),4749,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4750 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),4750,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4751 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4751,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4752 } else {
4753 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),4753,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4754 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),4754,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4755 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),4755,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4756 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),4756,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4757 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4757,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4758 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),4758,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4759 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),4759,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4760 ierr = MatDestroy(&AUXMAT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4760,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4761 }
4762 ierr = MatAXPY(TM1,one,TM2,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4762,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4763 ierr = MatAXPY(TM1,one,TM3,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4763,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4764 ierr = MatAXPY(TM1,one,TM4,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4764,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4765 ierr = MatConvert(TM1,MATSEQDENSE"seqdense",MAT_INPLACE_MATRIX,&TM1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4765,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4766 if (pcbddc->benign_n) {
4767 Mat B0_B,B0_BPHI;
4768 const PetscScalar *data2;
4769 PetscScalar *data;
4770 PetscInt j;
4771
4772 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),4772,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4773 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),4773,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4774 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),4774,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4775 ierr = MatConvert(B0_BPHI,MATSEQDENSE"seqdense",MAT_INPLACE_MATRIX,&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4775,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4776 ierr = MatDenseGetArray(TM1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4776,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4777 ierr = MatDenseGetArrayRead(B0_BPHI,&data2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4777,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4778 for (j=0;j<pcbddc->benign_n;j++) {
4779 PetscInt primal_idx = pcbddc->local_primal_size - pcbddc->benign_n + j;
4780 for (i=0;i<pcbddc->local_primal_size;i++) {
4781 data[primal_idx*pcbddc->local_primal_size+i] += data2[i*pcbddc->benign_n+j];
4782 data[i*pcbddc->local_primal_size+primal_idx] += data2[i*pcbddc->benign_n+j];
4783 }
4784 }
4785 ierr = MatDenseRestoreArray(TM1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4785,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4786 ierr = MatDenseRestoreArrayRead(B0_BPHI,&data2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4786,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4787 ierr = MatDestroy(&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4787,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4788 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4788,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4789 ierr = MatDestroy(&B0_BPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4789,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4790 }
4791#if 0
4792 {
4793 PetscViewer viewer;
4794 char filename[256];
4795 sprintf(filename,"details_local_coarse_mat%d_level%d.m",PetscGlobalRank,pcbddc->current_level);
4796 ierr = PetscViewerASCIIOpen(PETSC_COMM_SELF((MPI_Comm)0x44000001),filename,&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4796,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4797 ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4797,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4798 ierr = PetscObjectSetName((PetscObject)coarse_sub_mat,"computed");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4798,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4799 ierr = MatView(coarse_sub_mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4799,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4800 ierr = PetscObjectSetName((PetscObject)TM1,"projected");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4800,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4801 ierr = MatView(TM1,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4801,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4802 if (pcbddc->coarse_phi_B) {
4803 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_phi_B,"phi_B");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4803,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4804 ierr = MatView(pcbddc->coarse_phi_B,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4804,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4805 }
4806 if (pcbddc->coarse_phi_D) {
4807 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_phi_D,"phi_D");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4807,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4808 ierr = MatView(pcbddc->coarse_phi_D,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4808,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4809 }
4810 if (pcbddc->coarse_psi_B) {
4811 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_psi_B,"psi_B");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4811,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4812 ierr = MatView(pcbddc->coarse_psi_B,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4812,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4813 }
4814 if (pcbddc->coarse_psi_D) {
4815 ierr = PetscObjectSetName((PetscObject)pcbddc->coarse_psi_D,"psi_D");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4815,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4816 ierr = MatView(pcbddc->coarse_psi_D,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4816,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4817 }
4818 ierr = PetscObjectSetName((PetscObject)pcbddc->local_mat,"A");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4818,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4819 ierr = MatView(pcbddc->local_mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4819,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4820 ierr = PetscObjectSetName((PetscObject)pcbddc->ConstraintMatrix,"C");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4820,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4821 ierr = MatView(pcbddc->ConstraintMatrix,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4821,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4822 ierr = PetscObjectSetName((PetscObject)pcis->is_I_local,"I");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4822,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4823 ierr = ISView(pcis->is_I_local,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4823,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4824 ierr = PetscObjectSetName((PetscObject)pcis->is_B_local,"B");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4824,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4825 ierr = ISView(pcis->is_B_local,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4825,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4826 ierr = PetscObjectSetName((PetscObject)pcbddc->is_R_local,"R");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4826,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4827 ierr = ISView(pcbddc->is_R_local,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4827,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4828 ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4828,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4829 }
4830#endif
4831 ierr = MatAXPY(TM1,m_one,coarse_sub_mat,DIFFERENT_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4831,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4832 ierr = MatNorm(TM1,NORM_FROBENIUS,&real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4832,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4833 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4833,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4834 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),4834,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4835
4836 /* check constraints */
4837 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),4837,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4838 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),4838,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4839 if (!pcbddc->benign_n) { /* TODO: add benign case */
4840 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),4840,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4841 } else {
4842 PetscScalar *data;
4843 Mat tmat;
4844 ierr = MatDenseGetArray(pcbddc->coarse_phi_B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4844,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4845 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),4845,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4846 ierr = MatDenseRestoreArray(pcbddc->coarse_phi_B,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4846,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4847 ierr = MatMatMult(C_B,tmat,MAT_INITIAL_MATRIX,1.0,&CPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4847,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4848 ierr = MatDestroy(&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4848,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4849 }
4850 ierr = MatCreateVecs(CPHI,&mones,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4850,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4851 ierr = VecSet(mones,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4851,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4852 ierr = MatDiagonalSet(CPHI,mones,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4852,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4853 ierr = MatNorm(CPHI,NORM_FROBENIUS,&real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4853,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4854 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),4854,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4855 if (!pcbddc->symmetric_primal) {
4856 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),4856,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4857 ierr = VecSet(mones,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4857,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4858 ierr = MatDiagonalSet(CPHI,mones,ADD_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4858,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4859 ierr = MatNorm(CPHI,NORM_FROBENIUS,&real_value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4859,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4860 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),4860,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4861 }
4862 ierr = MatDestroy(&C_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4862,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4863 ierr = MatDestroy(&CPHI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4863,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4864 ierr = ISDestroy(&is_dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4864,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4865 ierr = VecDestroy(&mones);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4865,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4866 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4866,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4867 ierr = MatDestroy(&A_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4867,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4868 ierr = MatDestroy(&A_BB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4868,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4869 ierr = MatDestroy(&A_IB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4869,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4870 ierr = MatDestroy(&A_BI);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4870,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4871 ierr = MatDestroy(&TM1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4871,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4872 ierr = MatDestroy(&TM2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4872,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4873 ierr = MatDestroy(&TM3);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4873,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4874 ierr = MatDestroy(&TM4);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4874,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4875 ierr = MatDestroy(&coarse_phi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4875,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4876 ierr = MatDestroy(&coarse_phi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4876,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4877 if (!pcbddc->symmetric_primal) {
4878 ierr = MatDestroy(&coarse_psi_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4878,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4879 ierr = MatDestroy(&coarse_psi_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4879,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4880 }
4881 ierr = MatDestroy(&coarse_sub_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4881,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4882 }
4883 /* get back data */
4884 *coarse_submat_vals_n = coarse_submat_vals;
4885 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),4885,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4886 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
4887}
4888
4889PetscErrorCode MatCreateSubMatrixUnsorted(Mat A, IS isrow, IS iscol, Mat* B)
4890{
4891 Mat *work_mat;
4892 IS isrow_s,iscol_s;
4893 PetscBool rsorted,csorted;
4894 PetscInt rsize,*idxs_perm_r=NULL((void*)0),csize,*idxs_perm_c=NULL((void*)0);
4895 PetscErrorCode ierr;
4896
4897 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 4897; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4898 ierr = ISSorted(isrow,&rsorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4898,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4899 ierr = ISSorted(iscol,&csorted);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4899,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4900 ierr = ISGetLocalSize(isrow,&rsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4900,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4901 ierr = ISGetLocalSize(iscol,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4901,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4902
4903 if (!rsorted) {
4904 const PetscInt *idxs;
4905 PetscInt *idxs_sorted,i;
4906
4907 ierr = PetscMalloc1(rsize,&idxs_perm_r)PetscMallocA(1,PETSC_FALSE,4907,__func__,"/sandbox/petsc/petsc.master/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),4907,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4908 ierr = PetscMalloc1(rsize,&idxs_sorted)PetscMallocA(1,PETSC_FALSE,4908,__func__,"/sandbox/petsc/petsc.master/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),4908,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4909 for (i=0;i<rsize;i++) {
4910 idxs_perm_r[i] = i;
4911 }
4912 ierr = ISGetIndices(isrow,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4912,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4913 ierr = PetscSortIntWithPermutation(rsize,idxs,idxs_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4913,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4914 for (i=0;i<rsize;i++) {
4915 idxs_sorted[i] = idxs[idxs_perm_r[i]];
4916 }
4917 ierr = ISRestoreIndices(isrow,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4917,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4918 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),4918,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4919 } else {
4920 ierr = PetscObjectReference((PetscObject)isrow);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4920,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4921 isrow_s = isrow;
4922 }
4923
4924 if (!csorted) {
4925 if (isrow == iscol) {
4926 ierr = PetscObjectReference((PetscObject)isrow_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4926,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4927 iscol_s = isrow_s;
4928 } else {
4929 const PetscInt *idxs;
4930 PetscInt *idxs_sorted,i;
4931
4932 ierr = PetscMalloc1(csize,&idxs_perm_c)PetscMallocA(1,PETSC_FALSE,4932,__func__,"/sandbox/petsc/petsc.master/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),4932,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4933 ierr = PetscMalloc1(csize,&idxs_sorted)PetscMallocA(1,PETSC_FALSE,4933,__func__,"/sandbox/petsc/petsc.master/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),4933,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4934 for (i=0;i<csize;i++) {
4935 idxs_perm_c[i] = i;
4936 }
4937 ierr = ISGetIndices(iscol,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4937,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4938 ierr = PetscSortIntWithPermutation(csize,idxs,idxs_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4938,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4939 for (i=0;i<csize;i++) {
4940 idxs_sorted[i] = idxs[idxs_perm_c[i]];
4941 }
4942 ierr = ISRestoreIndices(iscol,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4942,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4943 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),4943,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4944 }
4945 } else {
4946 ierr = PetscObjectReference((PetscObject)iscol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4946,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4947 iscol_s = iscol;
4948 }
4949
4950 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),4950,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4951
4952 if (!rsorted || !csorted) {
4953 Mat new_mat;
4954 IS is_perm_r,is_perm_c;
4955
4956 if (!rsorted) {
4957 PetscInt *idxs_r,i;
4958 ierr = PetscMalloc1(rsize,&idxs_r)PetscMallocA(1,PETSC_FALSE,4958,__func__,"/sandbox/petsc/petsc.master/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),4958,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4959 for (i=0;i<rsize;i++) {
4960 idxs_r[idxs_perm_r[i]] = i;
4961 }
4962 ierr = PetscFree(idxs_perm_r)((*PetscTrFree)((void*)(idxs_perm_r),4962,__func__,"/sandbox/petsc/petsc.master/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),4962,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4963 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),4963,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4964 } else {
4965 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),4965,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4966 }
4967 ierr = ISSetPermutation(is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4967,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4968
4969 if (!csorted) {
4970 if (isrow_s == iscol_s) {
4971 ierr = PetscObjectReference((PetscObject)is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4971,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4972 is_perm_c = is_perm_r;
4973 } else {
4974 PetscInt *idxs_c,i;
4975 if (!idxs_perm_c) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Permutation array not present")return PetscError(((MPI_Comm)0x44000001),4975,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Permutation array not present")
;
4976 ierr = PetscMalloc1(csize,&idxs_c)PetscMallocA(1,PETSC_FALSE,4976,__func__,"/sandbox/petsc/petsc.master/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),4976,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4977 for (i=0;i<csize;i++) {
4978 idxs_c[idxs_perm_c[i]] = i;
4979 }
4980 ierr = PetscFree(idxs_perm_c)((*PetscTrFree)((void*)(idxs_perm_c),4980,__func__,"/sandbox/petsc/petsc.master/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),4980,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4981 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),4981,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4982 }
4983 } else {
4984 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),4984,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4985 }
4986 ierr = ISSetPermutation(is_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4986,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4987
4988 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),4988,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4989 ierr = MatDestroy(&work_mat[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4989,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4990 work_mat[0] = new_mat;
4991 ierr = ISDestroy(&is_perm_r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4991,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4992 ierr = ISDestroy(&is_perm_c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4992,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4993 }
4994
4995 ierr = PetscObjectReference((PetscObject)work_mat[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4995,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4996 *B = work_mat[0];
4997 ierr = MatDestroyMatrices(1,&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4997,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4998 ierr = ISDestroy(&isrow_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4998,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4999 ierr = ISDestroy(&iscol_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4999,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5000 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5001}
5002
5003PetscErrorCode PCBDDCComputeLocalMatrix(PC pc, Mat ChangeOfBasisMatrix)
5004{
5005 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
5006 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
5007 Mat new_mat,lA;
5008 IS is_local,is_global;
5009 PetscInt local_size;
5010 PetscBool isseqaij;
5011 PetscErrorCode ierr;
5012
5013 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5013; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5014 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5014,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5015 ierr = MatGetSize(matis->A,&local_size,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5015,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5016 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),5016,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5017 ierr = ISLocalToGlobalMappingApplyIS(pc->pmat->rmap->mapping,is_local,&is_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5017,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5018 ierr = ISDestroy(&is_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5018,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5019 ierr = MatCreateSubMatrixUnsorted(ChangeOfBasisMatrix,is_global,is_global,&new_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5019,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5020 ierr = ISDestroy(&is_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5020,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5021
5022 /* check */
5023 if (pcbddc->dbg_flag) {
5024 Vec x,x_change;
5025 PetscReal error;
5026
5027 ierr = MatCreateVecs(ChangeOfBasisMatrix,&x,&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5027,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5028 ierr = VecSetRandom(x,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5028,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5029 ierr = MatMult(ChangeOfBasisMatrix,x,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5029,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5030 ierr = VecScatterBegin(matis->cctx,x,matis->x,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5030,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5031 ierr = VecScatterEnd(matis->cctx,x,matis->x,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5031,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5032 ierr = MatMult(new_mat,matis->x,matis->y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5032,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5033 if (!pcbddc->change_interior) {
5034 const PetscScalar *x,*y,*v;
5035 PetscReal lerror = 0.;
5036 PetscInt i;
5037
5038 ierr = VecGetArrayRead(matis->x,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5038,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5039 ierr = VecGetArrayRead(matis->y,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5039,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5040 ierr = VecGetArrayRead(matis->counter,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5040,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5041 for (i=0;i<local_size;i++)
5042 if (PetscRealPart(v[i])(v[i]) < 1.5 && PetscAbsScalar(x[i]-y[i])fabs(x[i]-y[i]) > lerror)
5043 lerror = PetscAbsScalar(x[i]-y[i])fabs(x[i]-y[i]);
5044 ierr = VecRestoreArrayRead(matis->x,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5044,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5045 ierr = VecRestoreArrayRead(matis->y,&y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5045,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5046 ierr = VecRestoreArrayRead(matis->counter,&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5046,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5047 ierr = MPIU_Allreduce(&lerror,&error,1,MPIU_REAL,MPI_MAX,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,5047,__func__,"/sandbox/petsc/petsc.master/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),5047,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5048 if (error > PETSC_SMALL1.e-10) {
5049 if (!pcbddc->user_ChangeOfBasisMatrix || pcbddc->current_level) {
5050 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"Error global vs local change on I: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5050,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error global vs local change on I: %1.6e"
,error)
;
5051 } else {
5052 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_USER,"Error global vs local change on I: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5052,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Error global vs local change on I: %1.6e"
,error)
;
5053 }
5054 }
5055 }
5056 ierr = VecScatterBegin(matis->rctx,matis->y,x,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5056,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5057 ierr = VecScatterEnd(matis->rctx,matis->y,x,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5057,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5058 ierr = VecAXPY(x,-1.0,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5058,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5059 ierr = VecNorm(x,NORM_INFINITY,&error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5059,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5060 if (error > PETSC_SMALL1.e-10) {
5061 if (!pcbddc->user_ChangeOfBasisMatrix || pcbddc->current_level) {
5062 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"Error global vs local change on N: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5062,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error global vs local change on N: %1.6e"
,error)
;
5063 } else {
5064 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_USER,"Error global vs local change on N: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),5064,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,83,PETSC_ERROR_INITIAL,"Error global vs local change on N: %1.6e"
,error)
;
5065 }
5066 }
5067 ierr = VecDestroy(&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5067,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5068 ierr = VecDestroy(&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5068,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5069 }
5070
5071 /* lA is present if we are setting up an inner BDDC for a saddle point FETI-DP */
5072 ierr = PetscObjectQuery((PetscObject)pc,"__KSPFETIDP_lA" ,(PetscObject*)&lA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5072,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5073
5074 /* TODO: HOW TO WORK WITH BAIJ and SBAIJ and SEQDENSE? */
5075 ierr = PetscObjectTypeCompare((PetscObject)matis->A,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5075,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5076 if (isseqaij) {
5077 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5077,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5078 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),5078,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5079 if (lA) {
5080 Mat work;
5081 ierr = MatPtAP(lA,new_mat,MAT_INITIAL_MATRIX,2.0,&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5081,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5082 ierr = PetscObjectCompose((PetscObject)pc,"__KSPFETIDP_lA" ,(PetscObject)work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5082,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5083 ierr = MatDestroy(&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5083,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5084 }
5085 } else {
5086 Mat work_mat;
5087
5088 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5088,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5089 ierr = MatConvert(matis->A,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5089,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5090 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),5090,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5091 ierr = MatDestroy(&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5091,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5092 if (lA) {
5093 Mat work;
5094 ierr = MatConvert(lA,MATSEQAIJ"seqaij",MAT_INITIAL_MATRIX,&work_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5094,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5095 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),5095,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5096 ierr = PetscObjectCompose((PetscObject)pc,"__KSPFETIDP_lA" ,(PetscObject)work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5096,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5097 ierr = MatDestroy(&work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5097,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5098 }
5099 }
5100 if (matis->A->symmetric_set) {
5101 ierr = MatSetOption(pcbddc->local_mat,MAT_SYMMETRIC,matis->A->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5101,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5102#if !defined(PETSC_USE_COMPLEX)
5103 ierr = MatSetOption(pcbddc->local_mat,MAT_HERMITIAN,matis->A->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5103,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5104#endif
5105 }
5106 ierr = MatDestroy(&new_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5106,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5107 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5108}
5109
5110PetscErrorCode PCBDDCSetUpLocalScatters(PC pc)
5111{
5112 PC_IS* pcis = (PC_IS*)(pc->data);
5113 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
5114 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5115 PetscInt *idx_R_local=NULL((void*)0);
5116 PetscInt n_vertices,i,j,n_R,n_D,n_B;
5117 PetscInt vbs,bs;
5118 PetscBT bitmask=NULL((void*)0);
5119 PetscErrorCode ierr;
5120
5121 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5121; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5122 /*
5123 No need to setup local scatters if
5124 - primal space is unchanged
5125 AND
5126 - we actually have locally some primal dofs (could not be true in multilevel or for isolated subdomains)
5127 AND
5128 - we are not in debugging mode (this is needed since there are Synchronized prints at the end of the subroutine
5129 */
5130 if (!pcbddc->new_primal_space_local && pcbddc->local_primal_size && !pcbddc->dbg_flag) {
5131 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5132 }
5133 /* destroy old objects */
5134 ierr = ISDestroy(&pcbddc->is_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5134,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5135 ierr = VecScatterDestroy(&pcbddc->R_to_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5135,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5136 ierr = VecScatterDestroy(&pcbddc->R_to_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5136,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5137 /* Set Non-overlapping dimensions */
5138 n_B = pcis->n_B;
5139 n_D = pcis->n - n_B;
5140 n_vertices = pcbddc->n_vertices;
5141
5142 /* Dohrmann's notation: dofs splitted in R (Remaining: all dofs but the vertices) and V (Vertices) */
5143
5144 /* create auxiliary bitmask and allocate workspace */
5145 if (!sub_schurs || !sub_schurs->reuse_solver) {
5146 ierr = PetscMalloc1(pcis->n-n_vertices,&idx_R_local)PetscMallocA(1,PETSC_FALSE,5146,__func__,"/sandbox/petsc/petsc.master/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),5146,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5147 ierr = PetscBTCreate(pcis->n,&bitmask);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5147,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5148 for (i=0;i<n_vertices;i++) {
5149 ierr = PetscBTSet(bitmask,pcbddc->local_primal_ref_node[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5149,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5150 }
5151
5152 for (i=0, n_R=0; i<pcis->n; i++) {
5153 if (!PetscBTLookup(bitmask,i)) {
5154 idx_R_local[n_R++] = i;
5155 }
5156 }
5157 } else { /* A different ordering (already computed) is present if we are reusing the Schur solver */
5158 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5159
5160 ierr = ISGetIndices(reuse_solver->is_R,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5160,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5161 ierr = ISGetLocalSize(reuse_solver->is_R,&n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5161,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5162 }
5163
5164 /* Block code */
5165 vbs = 1;
5166 ierr = MatGetBlockSize(pcbddc->local_mat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5166,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5167 if (bs>1 && !(n_vertices%bs)) {
5168 PetscBool is_blocked = PETSC_TRUE;
5169 PetscInt *vary;
5170 if (!sub_schurs || !sub_schurs->reuse_solver) {
5171 ierr = PetscMalloc1(pcis->n/bs,&vary)PetscMallocA(1,PETSC_FALSE,5171,__func__,"/sandbox/petsc/petsc.master/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),5171,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5172 ierr = PetscArrayzero(vary,pcis->n/bs)PetscMemzero(vary,(pcis->n/bs)*sizeof(*(vary)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5172,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5173 /* Verify that the vertex indices correspond to each element in a block (code taken from sbaij2.c) */
5174 /* 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 */
5175 for (i=0; i<n_vertices; i++) vary[pcbddc->local_primal_ref_node[i]/bs]++;
5176 for (i=0; i<pcis->n/bs; i++) {
5177 if (vary[i]!=0 && vary[i]!=bs) {
5178 is_blocked = PETSC_FALSE;
5179 break;
5180 }
5181 }
5182 ierr = PetscFree(vary)((*PetscTrFree)((void*)(vary),5182,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vary) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5182,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5183 } else {
5184 /* Verify directly the R set */
5185 for (i=0; i<n_R/bs; i++) {
5186 PetscInt j,node=idx_R_local[bs*i];
5187 for (j=1; j<bs; j++) {
5188 if (node != idx_R_local[bs*i+j]-j) {
5189 is_blocked = PETSC_FALSE;
5190 break;
5191 }
5192 }
5193 }
5194 }
5195 if (is_blocked) { /* build compressed IS for R nodes (complement of vertices) */
5196 vbs = bs;
5197 for (i=0;i<n_R/vbs;i++) {
5198 idx_R_local[i] = idx_R_local[vbs*i]/vbs;
5199 }
5200 }
5201 }
5202 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),5202,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5203 if (sub_schurs && sub_schurs->reuse_solver) {
5204 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5205
5206 ierr = ISRestoreIndices(reuse_solver->is_R,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5206,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5207 ierr = ISDestroy(&reuse_solver->is_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5207,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5208 ierr = PetscObjectReference((PetscObject)pcbddc->is_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5209 reuse_solver->is_R = pcbddc->is_R_local;
5210 } else {
5211 ierr = PetscFree(idx_R_local)((*PetscTrFree)((void*)(idx_R_local),5211,__func__,"/sandbox/petsc/petsc.master/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),5211,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5212 }
5213
5214 /* print some info if requested */
5215 if (pcbddc->dbg_flag) {
5216 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5216,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5217 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5217,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5218 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5218,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5219 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d local dimensions\n",PetscGlobalRank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5219,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5220 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),5220,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5221 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),5221,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5222 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5222,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5223 }
5224
5225 /* VecScatters pcbddc->R_to_B and (optionally) pcbddc->R_to_D */
5226 if (!sub_schurs || !sub_schurs->reuse_solver) {
5227 IS is_aux1,is_aux2;
5228 PetscInt *aux_array1,*aux_array2,*is_indices,*idx_R_local;
5229
5230 ierr = ISGetIndices(pcbddc->is_R_local,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5230,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5231 ierr = PetscMalloc1(pcis->n_B-n_vertices,&aux_array1)PetscMallocA(1,PETSC_FALSE,5231,__func__,"/sandbox/petsc/petsc.master/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),5231,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5232 ierr = PetscMalloc1(pcis->n_B-n_vertices,&aux_array2)PetscMallocA(1,PETSC_FALSE,5232,__func__,"/sandbox/petsc/petsc.master/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),5232,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5233 ierr = ISGetIndices(pcis->is_I_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5233,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5234 for (i=0; i<n_D; i++) {
5235 ierr = PetscBTSet(bitmask,is_indices[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5235,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5236 }
5237 ierr = ISRestoreIndices(pcis->is_I_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5237,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5238 for (i=0, j=0; i<n_R; i++) {
5239 if (!PetscBTLookup(bitmask,idx_R_local[i])) {
5240 aux_array1[j++] = i;
5241 }
5242 }
5243 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),5243,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5244 ierr = ISGetIndices(pcis->is_B_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5244,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5245 for (i=0, j=0; i<n_B; i++) {
5246 if (!PetscBTLookup(bitmask,is_indices[i])) {
5247 aux_array2[j++] = i;
5248 }
5249 }
5250 ierr = ISRestoreIndices(pcis->is_B_local,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5251 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),5251,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5252 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),5252,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5253 ierr = ISDestroy(&is_aux1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5253,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5254 ierr = ISDestroy(&is_aux2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5254,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5255
5256 if (pcbddc->switch_static || pcbddc->dbg_flag) {
5257 ierr = PetscMalloc1(n_D,&aux_array1)PetscMallocA(1,PETSC_FALSE,5257,__func__,"/sandbox/petsc/petsc.master/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),5257,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5258 for (i=0, j=0; i<n_R; i++) {
5259 if (PetscBTLookup(bitmask,idx_R_local[i])) {
5260 aux_array1[j++] = i;
5261 }
5262 }
5263 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),5263,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5264 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),5264,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5265 ierr = ISDestroy(&is_aux1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5265,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5266 }
5267 ierr = PetscBTDestroy(&bitmask);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5267,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5268 ierr = ISRestoreIndices(pcbddc->is_R_local,(const PetscInt**)&idx_R_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5268,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5269 } else {
5270 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5271 IS tis;
5272 PetscInt schur_size;
5273
5274 ierr = ISGetLocalSize(reuse_solver->is_B,&schur_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5274,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5275 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),5275,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5276 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),5276,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5277 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5277,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5278 if (pcbddc->switch_static || pcbddc->dbg_flag) {
5279 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),5279,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5280 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),5280,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5281 ierr = ISDestroy(&tis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5281,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5282 }
5283 }
5284 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5285}
5286
5287static PetscErrorCode MatNullSpacePropagate_Private(Mat A, IS is, Mat B)
5288{
5289 MatNullSpace NullSpace;
5290 Mat dmat;
5291 const Vec *nullvecs;
5292 Vec v,v2,*nullvecs2;
5293 VecScatter sct;
5294 PetscInt k,nnsp_size,bsiz,n,N,bs;
5295 PetscBool nnsp_has_cnst;
5296 PetscErrorCode ierr;
5297
5298 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5298; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5299 ierr = MatGetNullSpace(B,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5299,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5300 if (!NullSpace) {
5301 ierr = MatGetNearNullSpace(B,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5301,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5302 }
5303 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)
;
5304 ierr = MatGetNullSpace(A,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5304,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5305 if (!NullSpace) {
5306 ierr = MatGetNearNullSpace(A,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5306,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5307 }
5308 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)
;
5309 ierr = MatCreateVecs(A,&v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5310 ierr = MatCreateVecs(B,&v2,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5310,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5311 ierr = VecScatterCreate(v,is,v2,NULL((void*)0),&sct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5311,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5312 ierr = MatNullSpaceGetVecs(NullSpace,&nnsp_has_cnst,&nnsp_size,(const Vec**)&nullvecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5312,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5313 bsiz = nnsp_size+!!nnsp_has_cnst;
5314 ierr = PetscMalloc1(bsiz,&nullvecs2)PetscMallocA(1,PETSC_FALSE,5314,__func__,"/sandbox/petsc/petsc.master/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),5314,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5315 ierr = VecGetBlockSize(v2,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5315,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5316 ierr = VecGetSize(v2,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5316,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5317 ierr = VecGetLocalSize(v2,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5317,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5318 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),5318,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5319 for (k=0;k<nnsp_size;k++) {
5320 PetscScalar *arr;
5321
5322 ierr = MatDenseGetColumn(dmat,k,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5322,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5323 ierr = VecCreateMPIWithArray(PetscObjectComm((PetscObject)B),bs,n,N,arr,&nullvecs2[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5323,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5324 ierr = VecScatterBegin(sct,nullvecs[k],nullvecs2[k],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5324,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5325 ierr = VecScatterEnd(sct,nullvecs[k],nullvecs2[k],INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5325,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5326 ierr = MatDenseRestoreColumn(dmat,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5326,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5327 }
5328 if (nnsp_has_cnst) {
5329 PetscScalar *arr;
5330
5331 ierr = MatDenseGetColumn(dmat,nnsp_size,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5331,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5332 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),5332,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5333 ierr = VecSet(nullvecs2[nnsp_size],1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5333,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5334 ierr = MatDenseRestoreColumn(dmat,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5334,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5335 }
5336 ierr = PCBDDCOrthonormalizeVecs(bsiz,nullvecs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5336,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5337 ierr = MatNullSpaceCreate(PetscObjectComm((PetscObject)B),PETSC_FALSE,bsiz,nullvecs2,&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5337,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5338 ierr = PetscObjectCompose((PetscObject)NullSpace,"_PBDDC_Null_dmat",(PetscObject)dmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5338,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5339 ierr = MatDestroy(&dmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5339,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5340 for (k=0;k<bsiz;k++) {
5341 ierr = VecDestroy(&nullvecs2[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5341,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5342 }
5343 ierr = PetscFree(nullvecs2)((*PetscTrFree)((void*)(nullvecs2),5343,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nullvecs2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5343,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5344 ierr = MatSetNearNullSpace(B,NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5344,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5345 ierr = MatNullSpaceDestroy(&NullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5345,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5346 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5346,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5347 ierr = VecDestroy(&v2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5347,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5348 ierr = VecScatterDestroy(&sct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5348,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5349 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5350}
5351
5352PetscErrorCode PCBDDCSetUpLocalSolvers(PC pc, PetscBool dirichlet, PetscBool neumann)
5353{
5354 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
5355 PC_IS *pcis = (PC_IS*)pc->data;
5356 PC pc_temp;
5357 Mat A_RR;
5358 MatNullSpace nnsp;
5359 MatReuse reuse;
5360 PetscScalar m_one = -1.0;
5361 PetscReal value;
5362 PetscInt n_D,n_R;
5363 PetscBool issbaij,opts;
5364 PetscErrorCode ierr;
5365 void (*f)(void) = 0;
5366 char dir_prefix[256],neu_prefix[256],str_level[16];
5367 size_t len;
5368
5369 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5369; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5370 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),5370,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5371 /* compute prefixes */
5372 ierr = PetscStrcpy(dir_prefix,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5373 ierr = PetscStrcpy(neu_prefix,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5373,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5374 if (!pcbddc->current_level) {
5375 ierr = PetscStrncpy(dir_prefix,((PetscObject)pc)->prefix,sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5375,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5376 ierr = PetscStrncpy(neu_prefix,((PetscObject)pc)->prefix,sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5376,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5377 ierr = PetscStrlcat(dir_prefix,"pc_bddc_dirichlet_",sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5377,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5378 ierr = PetscStrlcat(neu_prefix,"pc_bddc_neumann_",sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5378,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5379 } else {
5380 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),5380,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5381 ierr = PetscStrlen(((PetscObject)pc)->prefix,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5381,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5382 len -= 15; /* remove "pc_bddc_coarse_" */
5383 if (pcbddc->current_level>1) len -= 3; /* remove "lX_" with X level number */
5384 if (pcbddc->current_level>10) len -= 1; /* remove another char from level number */
5385 /* Nonstandard use of PetscStrncpy() to only copy a portion of the input string */
5386 ierr = PetscStrncpy(dir_prefix,((PetscObject)pc)->prefix,len+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5386,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5387 ierr = PetscStrncpy(neu_prefix,((PetscObject)pc)->prefix,len+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5387,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5388 ierr = PetscStrlcat(dir_prefix,"pc_bddc_dirichlet_",sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5388,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5389 ierr = PetscStrlcat(neu_prefix,"pc_bddc_neumann_",sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5389,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5390 ierr = PetscStrlcat(dir_prefix,str_level,sizeof(dir_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5390,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5391 ierr = PetscStrlcat(neu_prefix,str_level,sizeof(neu_prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5391,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5392 }
5393
5394 /* DIRICHLET PROBLEM */
5395 if (dirichlet) {
5396 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5397 if (pcbddc->benign_n && !pcbddc->benign_change_explicit) {
5398 if (!sub_schurs || !sub_schurs->reuse_solver) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Not yet implemented")return PetscError(((MPI_Comm)0x44000001),5398,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
5399 if (pcbddc->dbg_flag) {
5400 Mat A_IIn;
5401
5402 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),5402,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5403 ierr = MatDestroy(&pcis->A_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5403,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5404 pcis->A_II = A_IIn;
5405 }
5406 }
5407 if (pcbddc->local_mat->symmetric_set) {
5408 ierr = MatSetOption(pcis->A_II,MAT_SYMMETRIC,pcbddc->local_mat->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5408,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5409 }
5410 /* Matrix for Dirichlet problem is pcis->A_II */
5411 n_D = pcis->n - pcis->n_B;
5412 opts = PETSC_FALSE;
5413 if (!pcbddc->ksp_D) { /* create object if not yet build */
5414 opts = PETSC_TRUE;
5415 ierr = KSPCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5415,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5416 ierr = PetscObjectIncrementTabLevel((PetscObject)pcbddc->ksp_D,(PetscObject)pc,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5416,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5417 /* default */
5418 ierr = KSPSetType(pcbddc->ksp_D,KSPPREONLY"preonly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5418,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5419 ierr = KSPSetOptionsPrefix(pcbddc->ksp_D,dir_prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5419,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5420 ierr = PetscObjectTypeCompare((PetscObject)pcis->pA_II,MATSEQSBAIJ"seqsbaij",&issbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5420,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5421 ierr = KSPGetPC(pcbddc->ksp_D,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5421,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5422 if (issbaij) {
5423 ierr = PCSetType(pc_temp,PCCHOLESKY"cholesky");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5423,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5424 } else {
5425 ierr = PCSetType(pc_temp,PCLU"lu");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5425,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5426 }
5427 ierr = KSPSetErrorIfNotConverged(pcbddc->ksp_D,pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5427,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5428 }
5429 ierr = MatSetOptionsPrefix(pcis->pA_II,((PetscObject)pcbddc->ksp_D)->prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5429,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5430 ierr = KSPSetOperators(pcbddc->ksp_D,pcis->A_II,pcis->pA_II);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5430,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5431 /* Allow user's customization */
5432 if (opts) {
5433 ierr = KSPSetFromOptions(pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5433,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5434 }
5435 if (pcbddc->NullSpace_corr[0]) { /* approximate solver, propagate NearNullSpace */
5436 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),5436,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5437 }
5438 ierr = MatGetNearNullSpace(pcis->pA_II,&nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5438,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5439 ierr = KSPGetPC(pcbddc->ksp_D,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5439,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5440 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),5440,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5441 if (f && pcbddc->mat_graph->cloc && !nnsp) {
5442 PetscReal *coords = pcbddc->mat_graph->coords,*scoords;
5443 const PetscInt *idxs;
5444 PetscInt cdim = pcbddc->mat_graph->cdim,nl,i,d;
5445
5446 ierr = ISGetLocalSize(pcis->is_I_local,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5446,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5447 ierr = ISGetIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5447,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5448 ierr = PetscMalloc1(nl*cdim,&scoords)PetscMallocA(1,PETSC_FALSE,5448,__func__,"/sandbox/petsc/petsc.master/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),5448,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5449 for (i=0;i<nl;i++) {
5450 for (d=0;d<cdim;d++) {
5451 scoords[i*cdim+d] = coords[idxs[i]*cdim+d];
5452 }
5453 }
5454 ierr = ISRestoreIndices(pcis->is_I_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5454,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5455 ierr = PCSetCoordinates(pc_temp,cdim,nl,scoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5455,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5456 ierr = PetscFree(scoords)((*PetscTrFree)((void*)(scoords),5456,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((scoords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5456,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5457 }
5458 if (sub_schurs && sub_schurs->reuse_solver) {
5459 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5460
5461 ierr = KSPSetPC(pcbddc->ksp_D,reuse_solver->interior_solver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5461,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5462 }
5463
5464 /* umfpack interface has a bug when matrix dimension is zero. TODO solve from umfpack interface */
5465 if (!n_D) {
5466 ierr = KSPGetPC(pcbddc->ksp_D,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5466,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5467 ierr = PCSetType(pc_temp,PCNONE"none");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5467,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5468 }
5469 /* set ksp_D into pcis data */
5470 ierr = PetscObjectReference((PetscObject)pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5470,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5471 ierr = KSPDestroy(&pcis->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5471,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5472 pcis->ksp_D = pcbddc->ksp_D;
5473 }
5474
5475 /* NEUMANN PROBLEM */
5476 A_RR = 0;
5477 if (neumann) {
5478 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5479 PetscInt ibs,mbs;
5480 PetscBool issbaij, reuse_neumann_solver;
5481 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
5482
5483 reuse_neumann_solver = PETSC_FALSE;
5484 if (sub_schurs && sub_schurs->reuse_solver) {
5485 IS iP;
5486
5487 reuse_neumann_solver = PETSC_TRUE;
5488 ierr = PetscObjectQuery((PetscObject)sub_schurs->A,"__KSPFETIDP_iP",(PetscObject*)&iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5488,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5489 if (iP) reuse_neumann_solver = PETSC_FALSE;
5490 }
5491 /* Matrix for Neumann problem is A_RR -> we need to create/reuse it at this point */
5492 ierr = ISGetSize(pcbddc->is_R_local,&n_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5492,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5493 if (pcbddc->ksp_R) { /* already created ksp */
5494 PetscInt nn_R;
5495 ierr = KSPGetOperators(pcbddc->ksp_R,NULL((void*)0),&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5495,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5496 ierr = PetscObjectReference((PetscObject)A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5496,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5497 ierr = MatGetSize(A_RR,&nn_R,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5497,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5498 if (nn_R != n_R) { /* old ksp is not reusable, so reset it */
5499 ierr = KSPReset(pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5499,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5500 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5500,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5501 reuse = MAT_INITIAL_MATRIX;
5502 } else { /* same sizes, but nonzero pattern depend on primal vertices so it can be changed */
5503 if (pcbddc->new_primal_space_local) { /* we are not sure the matrix will have the same nonzero pattern */
5504 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5504,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5505 reuse = MAT_INITIAL_MATRIX;
5506 } else { /* safe to reuse the matrix */
5507 reuse = MAT_REUSE_MATRIX;
5508 }
5509 }
5510 /* last check */
5511 if (pc->flag == DIFFERENT_NONZERO_PATTERN) {
5512 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5512,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5513 reuse = MAT_INITIAL_MATRIX;
5514 }
5515 } else { /* first time, so we need to create the matrix */
5516 reuse = MAT_INITIAL_MATRIX;
5517 }
5518 /* convert pcbddc->local_mat if needed later in PCBDDCSetUpCorrection */
5519 ierr = MatGetBlockSize(pcbddc->local_mat,&mbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5519,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5520 ierr = ISGetBlockSize(pcbddc->is_R_local,&ibs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5520,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5521 ierr = PetscObjectTypeCompare((PetscObject)pcbddc->local_mat,MATSEQSBAIJ"seqsbaij",&issbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5521,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5522 if (ibs != mbs) { /* need to convert to SEQAIJ to extract any submatrix with is_R_local */
5523 if (matis->A == pcbddc->local_mat) {
5524 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5524,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5525 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),5525,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5526 } else {
5527 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),5527,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5528 }
5529 } else if (issbaij) { /* need to convert to BAIJ to get offdiagonal blocks */
5530 if (matis->A == pcbddc->local_mat) {
5531 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5531,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5532 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),5532,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5533 } else {
5534 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),5534,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5535 }
5536 }
5537 /* extract A_RR */
5538 if (reuse_neumann_solver) {
5539 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5540
5541 if (pcbddc->dbg_flag) { /* we need A_RR to test the solver later */
5542 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5542,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5543 if (reuse_solver->benign_n) { /* we are not using the explicit change of basis on the pressures */
5544 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),5544,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5545 } else {
5546 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),5546,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5547 }
5548 } else {
5549 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5549,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5550 ierr = PCGetOperators(reuse_solver->correction_solver,&A_RR,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5550,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5551 ierr = PetscObjectReference((PetscObject)A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5551,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5552 }
5553 } else { /* we have to build the neumann solver, so we need to extract the relevant matrix */
5554 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),5554,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5555 }
5556 if (pcbddc->local_mat->symmetric_set) {
5557 ierr = MatSetOption(A_RR,MAT_SYMMETRIC,pcbddc->local_mat->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5557,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5558 }
5559 opts = PETSC_FALSE;
5560 if (!pcbddc->ksp_R) { /* create object if not present */
5561 opts = PETSC_TRUE;
5562 ierr = KSPCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5562,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5563 ierr = PetscObjectIncrementTabLevel((PetscObject)pcbddc->ksp_R,(PetscObject)pc,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5563,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5564 /* default */
5565 ierr = KSPSetType(pcbddc->ksp_R,KSPPREONLY"preonly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5565,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5566 ierr = KSPSetOptionsPrefix(pcbddc->ksp_R,neu_prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5566,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5567 ierr = KSPGetPC(pcbddc->ksp_R,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5567,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5568 ierr = PetscObjectTypeCompare((PetscObject)A_RR,MATSEQSBAIJ"seqsbaij",&issbaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5568,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5569 if (issbaij) {
5570 ierr = PCSetType(pc_temp,PCCHOLESKY"cholesky");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5570,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5571 } else {
5572 ierr = PCSetType(pc_temp,PCLU"lu");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5572,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5573 }
5574 ierr = KSPSetErrorIfNotConverged(pcbddc->ksp_R,pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5574,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5575 }
5576 ierr = KSPSetOperators(pcbddc->ksp_R,A_RR,A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5576,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5577 ierr = MatSetOptionsPrefix(A_RR,((PetscObject)pcbddc->ksp_R)->prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5577,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5578 if (opts) { /* Allow user's customization once */
5579 ierr = KSPSetFromOptions(pcbddc->ksp_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5579,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5580 }
5581 if (pcbddc->NullSpace_corr[2]) { /* approximate solver, propagate NearNullSpace */
5582 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),5582,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5583 }
5584 ierr = MatGetNearNullSpace(A_RR,&nnsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5584,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5585 ierr = KSPGetPC(pcbddc->ksp_R,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5585,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5586 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),5586,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5587 if (f && pcbddc->mat_graph->cloc && !nnsp) {
5588 PetscReal *coords = pcbddc->mat_graph->coords,*scoords;
5589 const PetscInt *idxs;
5590 PetscInt cdim = pcbddc->mat_graph->cdim,nl,i,d;
5591
5592 ierr = ISGetLocalSize(pcbddc->is_R_local,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5592,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5593 ierr = ISGetIndices(pcbddc->is_R_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5593,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5594 ierr = PetscMalloc1(nl*cdim,&scoords)PetscMallocA(1,PETSC_FALSE,5594,__func__,"/sandbox/petsc/petsc.master/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),5594,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5595 for (i=0;i<nl;i++) {
5596 for (d=0;d<cdim;d++) {
5597 scoords[i*cdim+d] = coords[idxs[i]*cdim+d];
5598 }
5599 }
5600 ierr = ISRestoreIndices(pcbddc->is_R_local,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5600,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5601 ierr = PCSetCoordinates(pc_temp,cdim,nl,scoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5601,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5602 ierr = PetscFree(scoords)((*PetscTrFree)((void*)(scoords),5602,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((scoords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5602,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5603 }
5604
5605 /* umfpack interface has a bug when matrix dimension is zero. TODO solve from umfpack interface */
5606 if (!n_R) {
5607 ierr = KSPGetPC(pcbddc->ksp_R,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5607,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5608 ierr = PCSetType(pc_temp,PCNONE"none");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5608,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5609 }
5610 /* Reuse solver if it is present */
5611 if (reuse_neumann_solver) {
5612 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5613
5614 ierr = KSPSetPC(pcbddc->ksp_R,reuse_solver->correction_solver);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5614,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5615 }
5616 }
5617
5618 if (pcbddc->dbg_flag) {
5619 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5619,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5620 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5620,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5621 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5621,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5622 }
5623
5624 /* adapt Dirichlet and Neumann solvers if a nullspace correction has been requested */
5625 if (pcbddc->NullSpace_corr[0]) {
5626 ierr = PCBDDCSetUseExactDirichlet(pc,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5626,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5627 }
5628 if (dirichlet && pcbddc->NullSpace_corr[0] && !pcbddc->switch_static) {
5629 ierr = PCBDDCNullSpaceAssembleCorrection(pc,PETSC_TRUE,pcbddc->NullSpace_corr[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5629,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5630 }
5631 if (neumann && pcbddc->NullSpace_corr[2]) {
5632 ierr = PCBDDCNullSpaceAssembleCorrection(pc,PETSC_FALSE,pcbddc->NullSpace_corr[3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5632,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5633 }
5634 /* check Dirichlet and Neumann solvers */
5635 if (pcbddc->dbg_flag) {
5636 if (dirichlet) { /* Dirichlet */
5637 ierr = VecSetRandom(pcis->vec1_D,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5637,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5638 ierr = MatMult(pcis->A_II,pcis->vec1_D,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5638,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5639 ierr = KSPSolve(pcbddc->ksp_D,pcis->vec2_D,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5639,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5640 ierr = KSPCheckSolve(pcbddc->ksp_D,pc,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5640,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5641 ierr = VecAXPY(pcis->vec1_D,m_one,pcis->vec2_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5641,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5642 ierr = VecNorm(pcis->vec1_D,NORM_INFINITY,&value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5642,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5643 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),5643,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5644 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5644,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5645 }
5646 if (neumann) { /* Neumann */
5647 ierr = VecSetRandom(pcbddc->vec1_R,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5647,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5648 ierr = MatMult(A_RR,pcbddc->vec1_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5648,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5649 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec2_R,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5649,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5650 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5650,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5651 ierr = VecAXPY(pcbddc->vec1_R,m_one,pcbddc->vec2_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5651,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5652 ierr = VecNorm(pcbddc->vec1_R,NORM_INFINITY,&value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5652,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5653 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),5653,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5654 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5654,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5655 }
5656 }
5657 /* free Neumann problem's matrix */
5658 ierr = MatDestroy(&A_RR);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5658,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5659 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),5659,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5660 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5661}
5662
5663static PetscErrorCode PCBDDCSolveSubstructureCorrection(PC pc, Vec inout_B, Vec inout_D, PetscBool applytranspose)
5664{
5665 PetscErrorCode ierr;
5666 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5667 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
5668 PetscBool reuse_solver = sub_schurs ? ( sub_schurs->reuse_solver ? PETSC_TRUE : PETSC_FALSE ) : PETSC_FALSE;
5669
5670 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5670; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5671 if (!reuse_solver) {
5672 ierr = VecSet(pcbddc->vec1_R,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5672,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5673 }
5674 if (!pcbddc->switch_static) {
5675 if (applytranspose && pcbddc->local_auxmat1) {
5676 ierr = MatMultTranspose(pcbddc->local_auxmat2,inout_B,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5676,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5677 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),5677,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5678 }
5679 if (!reuse_solver) {
5680 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),5680,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5681 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),5681,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5682 } else {
5683 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5684
5685 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),5685,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5686 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),5686,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5687 }
5688 } else {
5689 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),5689,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5690 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),5690,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5691 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),5691,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5692 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),5692,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5693 if (applytranspose && pcbddc->local_auxmat1) {
5694 ierr = MatMultTranspose(pcbddc->local_auxmat2,pcbddc->vec1_R,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5694,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5695 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),5695,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5696 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),5696,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5697 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),5697,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5698 }
5699 }
5700 if (!reuse_solver || pcbddc->switch_static) {
5701 if (applytranspose) {
5702 ierr = KSPSolveTranspose(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5702,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5703 } else {
5704 ierr = KSPSolve(pcbddc->ksp_R,pcbddc->vec1_R,pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5704,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5705 }
5706 ierr = KSPCheckSolve(pcbddc->ksp_R,pc,pcbddc->vec1_R);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5706,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5707 } else {
5708 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5709
5710 if (applytranspose) {
5711 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),5711,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5712 } else {
5713 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),5713,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5714 }
5715 }
5716 ierr = VecSet(inout_B,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5716,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5717 if (!pcbddc->switch_static) {
5718 if (!reuse_solver) {
5719 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),5719,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5720 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),5720,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5721 } else {
5722 PCBDDCReuseSolvers reuse_solver = sub_schurs->reuse_solver;
5723
5724 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),5724,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5725 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),5725,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5726 }
5727 if (!applytranspose && pcbddc->local_auxmat1) {
5728 ierr = MatMult(pcbddc->local_auxmat1,inout_B,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5728,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5729 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),5729,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5730 }
5731 } else {
5732 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),5732,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5733 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),5733,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5734 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),5734,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5735 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),5735,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5736 if (!applytranspose && pcbddc->local_auxmat1) {
5737 ierr = MatMult(pcbddc->local_auxmat1,inout_B,pcbddc->vec1_C);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5737,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5738 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),5738,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5739 }
5740 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),5740,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5741 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),5741,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5742 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),5742,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5743 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),5743,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5744 }
5745 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5746}
5747
5748/* parameter apply transpose determines if the interface preconditioner should be applied transposed or not */
5749PetscErrorCode PCBDDCApplyInterfacePreconditioner(PC pc, PetscBool applytranspose)
5750{
5751 PetscErrorCode ierr;
5752 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5753 PC_IS* pcis = (PC_IS*) (pc->data);
5754 const PetscScalar zero = 0.0;
5755
5756 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5756; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5757 /* Application of PSI^T or PHI^T (depending on applytranspose, see comment above) */
5758 if (!pcbddc->benign_apply_coarse_only) {
5759 if (applytranspose) {
5760 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),5760,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5761 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),5761,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5762 } else {
5763 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),5763,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5764 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),5764,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5765 }
5766 } else {
5767 ierr = VecSet(pcbddc->vec1_P,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5767,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5768 }
5769
5770 /* add p0 to the last value of vec1_P holding the coarse dof relative to p0 */
5771 if (pcbddc->benign_n) {
5772 PetscScalar *array;
5773 PetscInt j;
5774
5775 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5775,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5776 for (j=0;j<pcbddc->benign_n;j++) array[pcbddc->local_primal_size-pcbddc->benign_n+j] += pcbddc->benign_p0[j];
5777 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5777,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5778 }
5779
5780 /* start communications from local primal nodes to rhs of coarse solver */
5781 ierr = VecSet(pcbddc->coarse_vec,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5781,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5782 ierr = PCBDDCScatterCoarseDataBegin(pc,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5782,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5783 ierr = PCBDDCScatterCoarseDataEnd(pc,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5783,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5784
5785 /* Coarse solution -> rhs and sol updated inside PCBDDCScattarCoarseDataBegin/End */
5786 if (pcbddc->coarse_ksp) {
5787 Mat coarse_mat;
5788 Vec rhs,sol;
5789 MatNullSpace nullsp;
5790 PetscBool isbddc = PETSC_FALSE;
5791
5792 if (pcbddc->benign_have_null) {
5793 PC coarse_pc;
5794
5795 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5795,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5796 ierr = PetscObjectTypeCompare((PetscObject)coarse_pc,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5796,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5797 /* we need to propagate to coarser levels the need for a possible benign correction */
5798 if (isbddc && pcbddc->benign_apply_coarse_only && !pcbddc->benign_skip_correction) {
5799 PC_BDDC* coarsepcbddc = (PC_BDDC*)(coarse_pc->data);
5800 coarsepcbddc->benign_skip_correction = PETSC_FALSE;
5801 coarsepcbddc->benign_apply_coarse_only = PETSC_TRUE;
5802 }
5803 }
5804 ierr = KSPGetRhs(pcbddc->coarse_ksp,&rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5804,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5805 ierr = KSPGetSolution(pcbddc->coarse_ksp,&sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5805,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5806 ierr = KSPGetOperators(pcbddc->coarse_ksp,&coarse_mat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5806,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5807 if (applytranspose) {
5808 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
),5808,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Not yet implemented")
;
5809 ierr = KSPSolveTranspose(pcbddc->coarse_ksp,rhs,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5809,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5810 ierr = KSPCheckSolve(pcbddc->coarse_ksp,pc,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5810,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5811 ierr = MatGetTransposeNullSpace(coarse_mat,&nullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5811,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5812 if (nullsp) {
5813 ierr = MatNullSpaceRemove(nullsp,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5813,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5814 }
5815 } else {
5816 ierr = MatGetNullSpace(coarse_mat,&nullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5816,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5817 if (pcbddc->benign_apply_coarse_only && isbddc) { /* need just to apply the coarse preconditioner during presolve */
5818 PC coarse_pc;
5819
5820 if (nullsp) {
5821 ierr = MatNullSpaceRemove(nullsp,rhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5821,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5822 }
5823 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5823,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5824 ierr = PCPreSolve(coarse_pc,pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5824,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5825 ierr = PCBDDCBenignRemoveInterior(coarse_pc,rhs,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5825,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5826 ierr = PCPostSolve(coarse_pc,pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5826,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5827 } else {
5828 ierr = KSPSolve(pcbddc->coarse_ksp,rhs,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5828,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5829 ierr = KSPCheckSolve(pcbddc->coarse_ksp,pc,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5829,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5830 if (nullsp) {
5831 ierr = MatNullSpaceRemove(nullsp,sol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5831,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5832 }
5833 }
5834 }
5835 /* we don't need the benign correction at coarser levels anymore */
5836 if (pcbddc->benign_have_null && isbddc) {
5837 PC coarse_pc;
5838 PC_BDDC* coarsepcbddc;
5839
5840 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5840,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5841 coarsepcbddc = (PC_BDDC*)(coarse_pc->data);
5842 coarsepcbddc->benign_skip_correction = PETSC_TRUE;
5843 coarsepcbddc->benign_apply_coarse_only = PETSC_FALSE;
5844 }
5845 }
5846
5847 /* Local solution on R nodes */
5848 if (pcis->n && !pcbddc->benign_apply_coarse_only) {
5849 ierr = PCBDDCSolveSubstructureCorrection(pc,pcis->vec1_B,pcis->vec1_D,applytranspose);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5849,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5850 }
5851 /* communications from coarse sol to local primal nodes */
5852 ierr = PCBDDCScatterCoarseDataBegin(pc,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5852,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5853 ierr = PCBDDCScatterCoarseDataEnd(pc,INSERT_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5853,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5854
5855 /* Sum contributions from the two levels */
5856 if (!pcbddc->benign_apply_coarse_only) {
5857 if (applytranspose) {
5858 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),5858,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5859 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),5859,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5860 } else {
5861 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),5861,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5862 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),5862,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
5863 }
5864 /* store p0 */
5865 if (pcbddc->benign_n) {
5866 PetscScalar *array;
5867 PetscInt j;
5868
5869 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5869,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5870 for (j=0;j<pcbddc->benign_n;j++) pcbddc->benign_p0[j] = array[pcbddc->local_primal_size-pcbddc->benign_n+j];
5871 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5871,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5872 }
5873 } else { /* expand the coarse solution */
5874 if (applytranspose) {
5875 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),5875,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5876 } else {
5877 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),5877,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5878 }
5879 }
5880 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5881}
5882
5883PetscErrorCode PCBDDCScatterCoarseDataBegin(PC pc,InsertMode imode, ScatterMode smode)
5884{
5885 PetscErrorCode ierr;
5886 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5887 PetscScalar *array;
5888 Vec from,to;
5889
5890 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5890; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5891 if (smode == SCATTER_REVERSE) { /* from global to local -> get data from coarse solution */
5892 from = pcbddc->coarse_vec;
5893 to = pcbddc->vec1_P;
5894 if (pcbddc->coarse_ksp) { /* get array from coarse processes */
5895 Vec tvec;
5896
5897 ierr = KSPGetRhs(pcbddc->coarse_ksp,&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5897,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5898 ierr = VecResetArray(tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5898,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5899 ierr = KSPGetSolution(pcbddc->coarse_ksp,&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5899,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5900 ierr = VecGetArray(tvec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5900,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5901 ierr = VecPlaceArray(from,array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5901,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5902 ierr = VecRestoreArray(tvec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5902,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5903 }
5904 } else { /* from local to global -> put data in coarse right hand side */
5905 from = pcbddc->vec1_P;
5906 to = pcbddc->coarse_vec;
5907 }
5908 ierr = VecScatterBegin(pcbddc->coarse_loc_to_glob,from,to,imode,smode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5908,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5909 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5910}
5911
5912PetscErrorCode PCBDDCScatterCoarseDataEnd(PC pc, InsertMode imode, ScatterMode smode)
5913{
5914 PetscErrorCode ierr;
5915 PC_BDDC* pcbddc = (PC_BDDC*)(pc->data);
5916 PetscScalar *array;
5917 Vec from,to;
5918
5919 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5919; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5920 if (smode == SCATTER_REVERSE) { /* from global to local -> get data from coarse solution */
5921 from = pcbddc->coarse_vec;
5922 to = pcbddc->vec1_P;
5923 } else { /* from local to global -> put data in coarse right hand side */
5924 from = pcbddc->vec1_P;
5925 to = pcbddc->coarse_vec;
5926 }
5927 ierr = VecScatterEnd(pcbddc->coarse_loc_to_glob,from,to,imode,smode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5927,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5928 if (smode == SCATTER_FORWARD) {
5929 if (pcbddc->coarse_ksp) { /* get array from coarse processes */
5930 Vec tvec;
5931
5932 ierr = KSPGetRhs(pcbddc->coarse_ksp,&tvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5932,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5933 ierr = VecGetArray(to,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5933,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5934 ierr = VecPlaceArray(tvec,array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5934,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5935 ierr = VecRestoreArray(to,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5935,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5936 }
5937 } else {
5938 if (pcbddc->coarse_ksp) { /* restore array of pcbddc->coarse_vec */
5939 ierr = VecResetArray(from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5939,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5940 }
5941 }
5942 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
5943}
5944
5945/* uncomment for testing purposes */
5946/* #define PETSC_MISSING_LAPACK_GESVD 1 */
5947PetscErrorCode PCBDDCConstraintsSetUp(PC pc)
5948{
5949 PetscErrorCode ierr;
5950 PC_IS* pcis = (PC_IS*)(pc->data);
5951 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
5952 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
5953 /* one and zero */
5954 PetscScalar one=1.0,zero=0.0;
5955 /* space to store constraints and their local indices */
5956 PetscScalar *constraints_data;
5957 PetscInt *constraints_idxs,*constraints_idxs_B;
5958 PetscInt *constraints_idxs_ptr,*constraints_data_ptr;
5959 PetscInt *constraints_n;
5960 /* iterators */
5961 PetscInt i,j,k,total_counts,total_counts_cc,cum;
5962 /* BLAS integers */
5963 PetscBLASInt lwork,lierr;
5964 PetscBLASInt Blas_N,Blas_M,Blas_K,Blas_one=1;
5965 PetscBLASInt Blas_LDA,Blas_LDB,Blas_LDC;
5966 /* reuse */
5967 PetscInt olocal_primal_size,olocal_primal_size_cc;
5968 PetscInt *olocal_primal_ref_node,*olocal_primal_ref_mult;
5969 /* change of basis */
5970 PetscBool qr_needed;
5971 PetscBT change_basis,qr_needed_idx;
5972 /* auxiliary stuff */
5973 PetscInt *nnz,*is_indices;
5974 PetscInt ncc;
5975 /* some quantities */
5976 PetscInt n_vertices,total_primal_vertices,valid_constraints;
5977 PetscInt size_of_constraint,max_size_of_constraint=0,max_constraints,temp_constraints;
5978 PetscReal tol; /* tolerance for retaining eigenmodes */
5979
5980 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 5980; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5981 tol = PetscSqrtReal(PETSC_SMALL)sqrt(1.e-10);
5982 /* Destroy Mat objects computed previously */
5983 ierr = MatDestroy(&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5983,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5984 ierr = MatDestroy(&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5984,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5985 ierr = MatDestroy(&pcbddc->switch_static_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5985,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5986 /* save info on constraints from previous setup (if any) */
5987 olocal_primal_size = pcbddc->local_primal_size;
5988 olocal_primal_size_cc = pcbddc->local_primal_size_cc;
5989 ierr = PetscMalloc2(olocal_primal_size_cc,&olocal_primal_ref_node,olocal_primal_size_cc,&olocal_primal_ref_mult)PetscMallocA(2,PETSC_FALSE,5989,__func__,"/sandbox/petsc/petsc.master/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),5989,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5990 ierr = PetscArraycpy(olocal_primal_ref_node,pcbddc->local_primal_ref_node,olocal_primal_size_cc)((sizeof(*(olocal_primal_ref_node)) != sizeof(*(pcbddc->local_primal_ref_node
))) || PetscMemcpy(olocal_primal_ref_node,pcbddc->local_primal_ref_node
,(olocal_primal_size_cc)*sizeof(*(olocal_primal_ref_node))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5990,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5991 ierr = PetscArraycpy(olocal_primal_ref_mult,pcbddc->local_primal_ref_mult,olocal_primal_size_cc)((sizeof(*(olocal_primal_ref_mult)) != sizeof(*(pcbddc->local_primal_ref_mult
))) || PetscMemcpy(olocal_primal_ref_mult,pcbddc->local_primal_ref_mult
,(olocal_primal_size_cc)*sizeof(*(olocal_primal_ref_mult))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5991,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5992 ierr = PetscFree2(pcbddc->local_primal_ref_node,pcbddc->local_primal_ref_mult)PetscFreeA(2,5992,__func__,"/sandbox/petsc/petsc.master/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),5992,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5993 ierr = PetscFree(pcbddc->primal_indices_local_idxs)((*PetscTrFree)((void*)(pcbddc->primal_indices_local_idxs)
,5993,__func__,"/sandbox/petsc/petsc.master/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),5993,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5994
5995 if (!pcbddc->adaptive_selection) {
5996 IS ISForVertices,*ISForFaces,*ISForEdges;
5997 MatNullSpace nearnullsp;
5998 const Vec *nearnullvecs;
5999 Vec *localnearnullsp;
6000 PetscScalar *array;
6001 PetscInt n_ISForFaces,n_ISForEdges,nnsp_size;
6002 PetscBool nnsp_has_cnst;
6003 /* LAPACK working arrays for SVD or POD */
6004 PetscBool skip_lapack,boolforchange;
6005 PetscScalar *work;
6006 PetscReal *singular_vals;
6007#if defined(PETSC_USE_COMPLEX)
6008 PetscReal *rwork;
6009#endif
6010#if defined(PETSC_MISSING_LAPACK_GESVD)
6011 PetscScalar *temp_basis,*correlation_mat;
6012#else
6013 PetscBLASInt dummy_int=1;
6014 PetscScalar dummy_scalar=1.;
6015#endif
6016
6017 /* Get index sets for faces, edges and vertices from graph */
6018 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),6018,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6019 /* print some info */
6020 if (pcbddc->dbg_flag && (!pcbddc->sub_schurs || pcbddc->sub_schurs_rebuild)) {
6021 PetscInt nv;
6022
6023 ierr = PCBDDCGraphASCIIView(pcbddc->mat_graph,pcbddc->dbg_flag,pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6023,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6024 ierr = ISGetSize(ISForVertices,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6024,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6025 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6025,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6026 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"--------------------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6026,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6027 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),6027,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6028 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),6028,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6029 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),6029,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6030 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6030,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6031 ierr = PetscViewerASCIIPopSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6031,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6032 }
6033
6034 /* free unneeded index sets */
6035 if (!pcbddc->use_vertices) {
6036 ierr = ISDestroy(&ISForVertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6036,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6037 }
6038 if (!pcbddc->use_edges) {
6039 for (i=0;i<n_ISForEdges;i++) {
6040 ierr = ISDestroy(&ISForEdges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6040,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6041 }
6042 ierr = PetscFree(ISForEdges)((*PetscTrFree)((void*)(ISForEdges),6042,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForEdges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6042,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6043 n_ISForEdges = 0;
6044 }
6045 if (!pcbddc->use_faces) {
6046 for (i=0;i<n_ISForFaces;i++) {
6047 ierr = ISDestroy(&ISForFaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6047,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6048 }
6049 ierr = PetscFree(ISForFaces)((*PetscTrFree)((void*)(ISForFaces),6049,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForFaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6049,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6050 n_ISForFaces = 0;
6051 }
6052
6053 /* check if near null space is attached to global mat */
6054 ierr = MatGetNearNullSpace(pc->pmat,&nearnullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6054,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6055 if (nearnullsp) {
6056 ierr = MatNullSpaceGetVecs(nearnullsp,&nnsp_has_cnst,&nnsp_size,&nearnullvecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6056,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6057 /* remove any stored info */
6058 ierr = MatNullSpaceDestroy(&pcbddc->onearnullspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6058,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6059 ierr = PetscFree(pcbddc->onearnullvecs_state)((*PetscTrFree)((void*)(pcbddc->onearnullvecs_state),6059,
__func__,"/sandbox/petsc/petsc.master/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),6059,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6060 /* store information for BDDC solver reuse */
6061 ierr = PetscObjectReference((PetscObject)nearnullsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6061,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6062 pcbddc->onearnullspace = nearnullsp;
6063 ierr = PetscMalloc1(nnsp_size,&pcbddc->onearnullvecs_state)PetscMallocA(1,PETSC_FALSE,6063,__func__,"/sandbox/petsc/petsc.master/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),6063,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6064 for (i=0;i<nnsp_size;i++) {
6065 ierr = PetscObjectStateGet((PetscObject)nearnullvecs[i],&pcbddc->onearnullvecs_state[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6065,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6066 }
6067 } else { /* if near null space is not provided BDDC uses constants by default */
6068 nnsp_size = 0;
6069 nnsp_has_cnst = PETSC_TRUE;
6070 }
6071 /* get max number of constraints on a single cc */
6072 max_constraints = nnsp_size;
6073 if (nnsp_has_cnst) max_constraints++;
6074
6075 /*
6076 Evaluate maximum storage size needed by the procedure
6077 - Indices for connected component i stored at "constraints_idxs + constraints_idxs_ptr[i]"
6078 - Values for constraints on connected component i stored at "constraints_data + constraints_data_ptr[i]"
6079 There can be multiple constraints per connected component
6080 */
6081 n_vertices = 0;
6082 if (ISForVertices) {
6083 ierr = ISGetSize(ISForVertices,&n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6083,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6084 }
6085 ncc = n_vertices+n_ISForFaces+n_ISForEdges;
6086 ierr = PetscMalloc3(ncc+1,&constraints_idxs_ptr,ncc+1,&constraints_data_ptr,ncc,&constraints_n)PetscMallocA(3,PETSC_FALSE,6086,__func__,"/sandbox/petsc/petsc.master/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),6086,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6087
6088 total_counts = n_ISForFaces+n_ISForEdges;
6089 total_counts *= max_constraints;
6090 total_counts += n_vertices;
6091 ierr = PetscBTCreate(total_counts,&change_basis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6091,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6092
6093 total_counts = 0;
6094 max_size_of_constraint = 0;
6095 for (i=0;i<n_ISForEdges+n_ISForFaces;i++) {
6096 IS used_is;
6097 if (i<n_ISForEdges) {
6098 used_is = ISForEdges[i];
6099 } else {
6100 used_is = ISForFaces[i-n_ISForEdges];
6101 }
6102 ierr = ISGetSize(used_is,&j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6102,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6103 total_counts += j;
6104 max_size_of_constraint = PetscMax(j,max_size_of_constraint)(((j)<(max_size_of_constraint)) ? (max_size_of_constraint)
: (j))
;
6105 }
6106 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,6106,__func__,"/sandbox/petsc/petsc.master/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),6106,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6107
6108 /* get local part of global near null space vectors */
6109 ierr = PetscMalloc1(nnsp_size,&localnearnullsp)PetscMallocA(1,PETSC_FALSE,6109,__func__,"/sandbox/petsc/petsc.master/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),6109,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6110 for (k=0;k<nnsp_size;k++) {
6111 ierr = VecDuplicate(pcis->vec1_N,&localnearnullsp[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6111,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6112 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),6112,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6113 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),6113,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6114 }
6115
6116 /* whether or not to skip lapack calls */
6117 skip_lapack = PETSC_TRUE;
6118 if (n_ISForFaces+n_ISForEdges && max_constraints > 1 && !pcbddc->use_nnsp_true) skip_lapack = PETSC_FALSE;
6119
6120 /* First we issue queries to allocate optimal workspace for LAPACKgesvd (or LAPACKsyev if SVD is missing) */
6121 if (!skip_lapack) {
6122 PetscScalar temp_work;
6123
6124#if defined(PETSC_MISSING_LAPACK_GESVD)
6125 /* Proper Orthogonal Decomposition (POD) using the snapshot method */
6126 ierr = PetscMalloc1(max_constraints*max_constraints,&correlation_mat)PetscMallocA(1,PETSC_FALSE,6126,__func__,"/sandbox/petsc/petsc.master/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),6126,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6127 ierr = PetscMalloc1(max_constraints,&singular_vals)PetscMallocA(1,PETSC_FALSE,6127,__func__,"/sandbox/petsc/petsc.master/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),6127,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6128 ierr = PetscMalloc1(max_size_of_constraint*max_constraints,&temp_basis)PetscMallocA(1,PETSC_FALSE,6128,__func__,"/sandbox/petsc/petsc.master/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),6128,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6129#if defined(PETSC_USE_COMPLEX)
6130 ierr = PetscMalloc1(3*max_constraints,&rwork)PetscMallocA(1,PETSC_FALSE,6130,__func__,"/sandbox/petsc/petsc.master/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),6130,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6131#endif
6132 /* now we evaluate the optimal workspace using query with lwork=-1 */
6133 ierr = PetscBLASIntCast(max_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6133,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6134 ierr = PetscBLASIntCast(max_constraints,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6134,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6135 lwork = -1;
6136 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6136,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6137#if !defined(PETSC_USE_COMPLEX)
6138 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6138; 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(6138,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6138,__func__,"/sandbox/petsc/petsc.master/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)
;
6139#else
6140 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6140; 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(6140,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6140,__func__,"/sandbox/petsc/petsc.master/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)
;
6141#endif
6142 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6142,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6143 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to SYEV Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6143,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to SYEV Lapack routine %d"
,(int)lierr)
;
6144#else /* on missing GESVD */
6145 /* SVD */
6146 PetscInt max_n,min_n;
6147 max_n = max_size_of_constraint;
6148 min_n = max_constraints;
6149 if (max_size_of_constraint < max_constraints) {
6150 min_n = max_size_of_constraint;
6151 max_n = max_constraints;
6152 }
6153 ierr = PetscMalloc1(min_n,&singular_vals)PetscMallocA(1,PETSC_FALSE,6153,__func__,"/sandbox/petsc/petsc.master/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),6153,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6154#if defined(PETSC_USE_COMPLEX)
6155 ierr = PetscMalloc1(5*min_n,&rwork)PetscMallocA(1,PETSC_FALSE,6155,__func__,"/sandbox/petsc/petsc.master/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),6155,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6156#endif
6157 /* now we evaluate the optimal workspace using query with lwork=-1 */
6158 lwork = -1;
6159 ierr = PetscBLASIntCast(max_n,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6159,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6160 ierr = PetscBLASIntCast(min_n,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6160,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6161 ierr = PetscBLASIntCast(max_n,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6161,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6162 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6162,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6163#if !defined(PETSC_USE_COMPLEX)
6164 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6164; 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
(6164,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6164,__func__,"/sandbox/petsc/petsc.master/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)
;
6165#else
6166 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6166; 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
(6166,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6166,__func__,"/sandbox/petsc/petsc.master/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)
;
6167#endif
6168 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6168,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6169 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to GESVD Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6169,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to GESVD Lapack routine %d"
,(int)lierr)
;
6170#endif /* on missing GESVD */
6171 /* Allocate optimal workspace */
6172 ierr = PetscBLASIntCast((PetscInt)PetscRealPart(temp_work)(temp_work),&lwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6172,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6173 ierr = PetscMalloc1(lwork,&work)PetscMallocA(1,PETSC_FALSE,6173,__func__,"/sandbox/petsc/petsc.master/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),6173,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6174 }
6175 /* Now we can loop on constraining sets */
6176 total_counts = 0;
6177 constraints_idxs_ptr[0] = 0;
6178 constraints_data_ptr[0] = 0;
6179 /* vertices */
6180 if (n_vertices) {
6181 ierr = ISGetIndices(ISForVertices,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6181,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6182 ierr = PetscArraycpy(constraints_idxs,is_indices,n_vertices)((sizeof(*(constraints_idxs)) != sizeof(*(is_indices))) || PetscMemcpy
(constraints_idxs,is_indices,(n_vertices)*sizeof(*(constraints_idxs
))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6182,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6183 for (i=0;i<n_vertices;i++) {
6184 constraints_n[total_counts] = 1;
6185 constraints_data[total_counts] = 1.0;
6186 constraints_idxs_ptr[total_counts+1] = constraints_idxs_ptr[total_counts]+1;
6187 constraints_data_ptr[total_counts+1] = constraints_data_ptr[total_counts]+1;
6188 total_counts++;
6189 }
6190 ierr = ISRestoreIndices(ISForVertices,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6190,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6191 n_vertices = total_counts;
6192 }
6193
6194 /* edges and faces */
6195 total_counts_cc = total_counts;
6196 for (ncc=0;ncc<n_ISForEdges+n_ISForFaces;ncc++) {
6197 IS used_is;
6198 PetscBool idxs_copied = PETSC_FALSE;
6199
6200 if (ncc<n_ISForEdges) {
6201 used_is = ISForEdges[ncc];
6202 boolforchange = pcbddc->use_change_of_basis; /* change or not the basis on the edge */
6203 } else {
6204 used_is = ISForFaces[ncc-n_ISForEdges];
6205 boolforchange = (PetscBool)(pcbddc->use_change_of_basis && pcbddc->use_change_on_faces); /* change or not the basis on the face */
6206 }
6207 temp_constraints = 0; /* zero the number of constraints I have on this conn comp */
6208
6209 ierr = ISGetSize(used_is,&size_of_constraint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6209,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6210 ierr = ISGetIndices(used_is,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6210,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6211 /* change of basis should not be performed on local periodic nodes */
6212 if (pcbddc->mat_graph->mirrors && pcbddc->mat_graph->mirrors[is_indices[0]]) boolforchange = PETSC_FALSE;
6213 if (nnsp_has_cnst) {
6214 PetscScalar quad_value;
6215
6216 ierr = PetscArraycpy(constraints_idxs + constraints_idxs_ptr[total_counts_cc],is_indices,size_of_constraint)((sizeof(*(constraints_idxs + constraints_idxs_ptr[total_counts_cc
])) != sizeof(*(is_indices))) || PetscMemcpy(constraints_idxs
+ constraints_idxs_ptr[total_counts_cc],is_indices,(size_of_constraint
)*sizeof(*(constraints_idxs + constraints_idxs_ptr[total_counts_cc
]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6216,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6217 idxs_copied = PETSC_TRUE;
6218
6219 if (!pcbddc->use_nnsp_true) {
6220 quad_value = (PetscScalar)(1.0/PetscSqrtReal((PetscReal)size_of_constraint)sqrt((PetscReal)size_of_constraint));
6221 } else {
6222 quad_value = 1.0;
6223 }
6224 for (j=0;j<size_of_constraint;j++) {
6225 constraints_data[constraints_data_ptr[total_counts_cc]+j] = quad_value;
6226 }
6227 temp_constraints++;
6228 total_counts++;
6229 }
6230 for (k=0;k<nnsp_size;k++) {
6231 PetscReal real_value;
6232 PetscScalar *ptr_to_data;
6233
6234 ierr = VecGetArrayRead(localnearnullsp[k],(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6234,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6235 ptr_to_data = &constraints_data[constraints_data_ptr[total_counts_cc]+temp_constraints*size_of_constraint];
6236 for (j=0;j<size_of_constraint;j++) {
6237 ptr_to_data[j] = array[is_indices[j]];
6238 }
6239 ierr = VecRestoreArrayRead(localnearnullsp[k],(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6239,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6240 /* check if array is null on the connected component */
6241 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6241,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6242 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6242; 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(6242,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6242,__func__,"/sandbox/petsc/petsc.master/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)
;
6243 if (real_value > tol*size_of_constraint) { /* keep indices and values */
6244 temp_constraints++;
6245 total_counts++;
6246 if (!idxs_copied) {
6247 ierr = PetscArraycpy(constraints_idxs + constraints_idxs_ptr[total_counts_cc],is_indices,size_of_constraint)((sizeof(*(constraints_idxs + constraints_idxs_ptr[total_counts_cc
])) != sizeof(*(is_indices))) || PetscMemcpy(constraints_idxs
+ constraints_idxs_ptr[total_counts_cc],is_indices,(size_of_constraint
)*sizeof(*(constraints_idxs + constraints_idxs_ptr[total_counts_cc
]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6247,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6248 idxs_copied = PETSC_TRUE;
6249 }
6250 }
6251 }
6252 ierr = ISRestoreIndices(used_is,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6252,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6253 valid_constraints = temp_constraints;
6254 if (!pcbddc->use_nnsp_true && temp_constraints) {
6255 if (temp_constraints == 1) { /* just normalize the constraint */
6256 PetscScalar norm,*ptr_to_data;
6257
6258 ptr_to_data = &constraints_data[constraints_data_ptr[total_counts_cc]];
6259 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6259,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6260 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6260; 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
(6260,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6260,__func__,"/sandbox/petsc/petsc.master/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)
;
6261 norm = 1.0/PetscSqrtReal(PetscRealPart(norm))sqrt((norm));
6262 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6262; 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(6262,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6262,__func__,"/sandbox/petsc/petsc.master/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)
;
6263 } else { /* perform SVD */
6264 PetscScalar *ptr_to_data = &constraints_data[constraints_data_ptr[total_counts_cc]];
6265
6266#if defined(PETSC_MISSING_LAPACK_GESVD)
6267 /* SVD: Y = U*S*V^H -> U (eigenvectors of Y*Y^H) = Y*V*(S)^\dag
6268 POD: Y^H*Y = V*D*V^H, D = S^H*S -> U = Y*V*D^(-1/2)
6269 -> When PETSC_USE_COMPLEX and PETSC_MISSING_LAPACK_GESVD are defined
6270 the constraints basis will differ (by a complex factor with absolute value equal to 1)
6271 from that computed using LAPACKgesvd
6272 -> This is due to a different computation of eigenvectors in LAPACKheev
6273 -> The quality of the POD-computed basis will be the same */
6274 ierr = PetscArrayzero(correlation_mat,temp_constraints*temp_constraints)PetscMemzero(correlation_mat,(temp_constraints*temp_constraints
)*sizeof(*(correlation_mat)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6274,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6275 /* Store upper triangular part of correlation matrix */
6276 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6276,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6277 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6277,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6278 for (j=0;j<temp_constraints;j++) {
6279 for (k=0;k<j+1;k++) {
6280 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6280; 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
(6280,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6280,__func__,"/sandbox/petsc/petsc.master/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)
;
6281 }
6282 }
6283 /* compute eigenvalues and eigenvectors of correlation matrix */
6284 ierr = PetscBLASIntCast(temp_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6284,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6285 ierr = PetscBLASIntCast(temp_constraints,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6285,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6286#if !defined(PETSC_USE_COMPLEX)
6287 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6287; 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(6287,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6287,__func__,"/sandbox/petsc/petsc.master/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)
;
6288#else
6289 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6289; 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(6289,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6289,__func__,"/sandbox/petsc/petsc.master/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)
;
6290#endif
6291 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6291,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6292 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in SYEV Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6292,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in SYEV Lapack routine %d",(int
)lierr)
;
6293 /* retain eigenvalues greater than tol: note that LAPACKsyev gives eigs in ascending order */
6294 j = 0;
6295 while (j < temp_constraints && singular_vals[j]/singular_vals[temp_constraints-1] < tol) j++;
6296 total_counts = total_counts-j;
6297 valid_constraints = temp_constraints-j;
6298 /* scale and copy POD basis into used quadrature memory */
6299 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6299,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6300 ierr = PetscBLASIntCast(temp_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6300,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6301 ierr = PetscBLASIntCast(temp_constraints,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6301,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6302 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6302,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6303 ierr = PetscBLASIntCast(temp_constraints,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6303,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6304 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6304,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6305 if (j<temp_constraints) {
6306 PetscInt ii;
6307 for (k=j;k<temp_constraints;k++) singular_vals[k] = 1.0/PetscSqrtReal(singular_vals[k])sqrt(singular_vals[k]);
6308 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6308,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6309 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6309; 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(6309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6309,__func__,"/sandbox/petsc/petsc.master/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)
;
6310 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6310,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6311 for (k=0;k<temp_constraints-j;k++) {
6312 for (ii=0;ii<size_of_constraint;ii++) {
6313 ptr_to_data[k*size_of_constraint+ii] = singular_vals[temp_constraints-1-k]*temp_basis[(temp_constraints-1-k)*size_of_constraint+ii];
6314 }
6315 }
6316 }
6317#else /* on missing GESVD */
6318 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6318,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6319 ierr = PetscBLASIntCast(temp_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6319,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6320 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6320,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6321 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6321,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6322#if !defined(PETSC_USE_COMPLEX)
6323 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6323; 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(6323,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6323,__func__,"/sandbox/petsc/petsc.master/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)
;
6324#else
6325 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6325; 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(6325,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6325,__func__,"/sandbox/petsc/petsc.master/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)
;
6326#endif
6327 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in GESVD Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6327,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in GESVD Lapack routine %d",(int
)lierr)
;
6328 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6328,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6329 /* retain eigenvalues greater than tol: note that LAPACKgesvd gives eigs in descending order */
6330 k = temp_constraints;
6331 if (k > size_of_constraint) k = size_of_constraint;
6332 j = 0;
6333 while (j < k && singular_vals[k-j-1]/singular_vals[0] < tol) j++;
6334 valid_constraints = k-j;
6335 total_counts = total_counts-temp_constraints+valid_constraints;
6336#endif /* on missing GESVD */
6337 }
6338 }
6339 /* update pointers information */
6340 if (valid_constraints) {
6341 constraints_n[total_counts_cc] = valid_constraints;
6342 constraints_idxs_ptr[total_counts_cc+1] = constraints_idxs_ptr[total_counts_cc]+size_of_constraint;
6343 constraints_data_ptr[total_counts_cc+1] = constraints_data_ptr[total_counts_cc]+size_of_constraint*valid_constraints;
6344 /* set change_of_basis flag */
6345 if (boolforchange) {
6346 PetscBTSet(change_basis,total_counts_cc);
6347 }
6348 total_counts_cc++;
6349 }
6350 }
6351 /* free workspace */
6352 if (!skip_lapack) {
6353 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),6353,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6353,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6354#if defined(PETSC_USE_COMPLEX)
6355 ierr = PetscFree(rwork)((*PetscTrFree)((void*)(rwork),6355,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((rwork) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6355,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6356#endif
6357 ierr = PetscFree(singular_vals)((*PetscTrFree)((void*)(singular_vals),6357,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((singular_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6357,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6358#if defined(PETSC_MISSING_LAPACK_GESVD)
6359 ierr = PetscFree(correlation_mat)((*PetscTrFree)((void*)(correlation_mat),6359,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((correlation_mat) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6359,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6360 ierr = PetscFree(temp_basis)((*PetscTrFree)((void*)(temp_basis),6360,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((temp_basis) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6360,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6361#endif
6362 }
6363 for (k=0;k<nnsp_size;k++) {
6364 ierr = VecDestroy(&localnearnullsp[k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6364,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6365 }
6366 ierr = PetscFree(localnearnullsp)((*PetscTrFree)((void*)(localnearnullsp),6366,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((localnearnullsp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6366,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6367 /* free index sets of faces, edges and vertices */
6368 for (i=0;i<n_ISForFaces;i++) {
6369 ierr = ISDestroy(&ISForFaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6369,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6370 }
6371 if (n_ISForFaces) {
6372 ierr = PetscFree(ISForFaces)((*PetscTrFree)((void*)(ISForFaces),6372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForFaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6373 }
6374 for (i=0;i<n_ISForEdges;i++) {
6375 ierr = ISDestroy(&ISForEdges[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6375,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6376 }
6377 if (n_ISForEdges) {
6378 ierr = PetscFree(ISForEdges)((*PetscTrFree)((void*)(ISForEdges),6378,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ISForEdges) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6378,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6379 }
6380 ierr = ISDestroy(&ISForVertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6380,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6381 } else {
6382 PCBDDCSubSchurs sub_schurs = pcbddc->sub_schurs;
6383
6384 total_counts = 0;
6385 n_vertices = 0;
6386 if (sub_schurs->is_vertices && pcbddc->use_vertices) {
6387 ierr = ISGetLocalSize(sub_schurs->is_vertices,&n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6387,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6388 }
6389 max_constraints = 0;
6390 total_counts_cc = 0;
6391 for (i=0;i<sub_schurs->n_subs+n_vertices;i++) {
6392 total_counts += pcbddc->adaptive_constraints_n[i];
6393 if (pcbddc->adaptive_constraints_n[i]) total_counts_cc++;
6394 max_constraints = PetscMax(max_constraints,pcbddc->adaptive_constraints_n[i])(((max_constraints)<(pcbddc->adaptive_constraints_n[i])
) ? (pcbddc->adaptive_constraints_n[i]) : (max_constraints
))
;
6395 }
6396 constraints_idxs_ptr = pcbddc->adaptive_constraints_idxs_ptr;
6397 constraints_data_ptr = pcbddc->adaptive_constraints_data_ptr;
6398 constraints_idxs = pcbddc->adaptive_constraints_idxs;
6399 constraints_data = pcbddc->adaptive_constraints_data;
6400 /* constraints_n differs from pcbddc->adaptive_constraints_n */
6401 ierr = PetscMalloc1(total_counts_cc,&constraints_n)PetscMallocA(1,PETSC_FALSE,6401,__func__,"/sandbox/petsc/petsc.master/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),6401,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6402 total_counts_cc = 0;
6403 for (i=0;i<sub_schurs->n_subs+n_vertices;i++) {
6404 if (pcbddc->adaptive_constraints_n[i]) {
6405 constraints_n[total_counts_cc++] = pcbddc->adaptive_constraints_n[i];
6406 }
6407 }
6408
6409 max_size_of_constraint = 0;
6410 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))
;
6411 ierr = PetscMalloc1(constraints_idxs_ptr[total_counts_cc],&constraints_idxs_B)PetscMallocA(1,PETSC_FALSE,6411,__func__,"/sandbox/petsc/petsc.master/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),6411,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6412 /* Change of basis */
6413 ierr = PetscBTCreate(total_counts_cc,&change_basis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6413,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6414 if (pcbddc->use_change_of_basis) {
6415 for (i=0;i<sub_schurs->n_subs;i++) {
6416 if (PetscBTLookup(sub_schurs->is_edge,i) || pcbddc->use_change_on_faces) {
6417 ierr = PetscBTSet(change_basis,i+n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6417,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6418 }
6419 }
6420 }
6421 }
6422 pcbddc->local_primal_size = total_counts;
6423 ierr = PetscMalloc1(pcbddc->local_primal_size+pcbddc->benign_n,&pcbddc->primal_indices_local_idxs)PetscMallocA(1,PETSC_FALSE,6423,__func__,"/sandbox/petsc/petsc.master/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),6423,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6424
6425 /* map constraints_idxs in boundary numbering */
6426 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),6426,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6427 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),6427,__func__,"/sandbox/petsc/petsc.master/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)
;
6428
6429 /* Create constraint matrix */
6430 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6430,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6431 ierr = MatSetType(pcbddc->ConstraintMatrix,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6431,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6432 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),6432,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6433
6434 /* find primal_dofs: subdomain corners plus dofs selected as primal after change of basis */
6435 /* determine if a QR strategy is needed for change of basis */
6436 qr_needed = pcbddc->use_qr_single;
6437 ierr = PetscBTCreate(total_counts_cc,&qr_needed_idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6437,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6438 total_primal_vertices=0;
6439 pcbddc->local_primal_size_cc = 0;
6440 for (i=0;i<total_counts_cc;i++) {
6441 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6442 if (size_of_constraint == 1 && pcbddc->mat_graph->custom_minimal_size) {
6443 pcbddc->primal_indices_local_idxs[total_primal_vertices++] = constraints_idxs[constraints_idxs_ptr[i]];
6444 pcbddc->local_primal_size_cc += 1;
6445 } else if (PetscBTLookup(change_basis,i)) {
6446 for (k=0;k<constraints_n[i];k++) {
6447 pcbddc->primal_indices_local_idxs[total_primal_vertices++] = constraints_idxs[constraints_idxs_ptr[i]+k];
6448 }
6449 pcbddc->local_primal_size_cc += constraints_n[i];
6450 if (constraints_n[i] > 1 || pcbddc->use_qr_single) {
6451 PetscBTSet(qr_needed_idx,i);
6452 qr_needed = PETSC_TRUE;
6453 }
6454 } else {
6455 pcbddc->local_primal_size_cc += 1;
6456 }
6457 }
6458 /* note that the local variable n_vertices used below stores the number of pointwise constraints */
6459 pcbddc->n_vertices = total_primal_vertices;
6460 /* permute indices in order to have a sorted set of vertices */
6461 ierr = PetscSortInt(total_primal_vertices,pcbddc->primal_indices_local_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6461,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6462 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,6462,__func__,"/sandbox/petsc/petsc.master/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),6462,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6463 ierr = PetscArraycpy(pcbddc->local_primal_ref_node,pcbddc->primal_indices_local_idxs,total_primal_vertices)((sizeof(*(pcbddc->local_primal_ref_node)) != sizeof(*(pcbddc
->primal_indices_local_idxs))) || PetscMemcpy(pcbddc->local_primal_ref_node
,pcbddc->primal_indices_local_idxs,(total_primal_vertices)
*sizeof(*(pcbddc->local_primal_ref_node))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6463,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6464 for (i=0;i<total_primal_vertices;i++) pcbddc->local_primal_ref_mult[i] = 1;
6465
6466 /* nonzero structure of constraint matrix */
6467 /* and get reference dof for local constraints */
6468 ierr = PetscMalloc1(pcbddc->local_primal_size,&nnz)PetscMallocA(1,PETSC_FALSE,6468,__func__,"/sandbox/petsc/petsc.master/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),6468,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6469 for (i=0;i<total_primal_vertices;i++) nnz[i] = 1;
6470
6471 j = total_primal_vertices;
6472 total_counts = total_primal_vertices;
6473 cum = total_primal_vertices;
6474 for (i=n_vertices;i<total_counts_cc;i++) {
6475 if (!PetscBTLookup(change_basis,i)) {
6476 pcbddc->local_primal_ref_node[cum] = constraints_idxs[constraints_idxs_ptr[i]];
6477 pcbddc->local_primal_ref_mult[cum] = constraints_n[i];
6478 cum++;
6479 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6480 for (k=0;k<constraints_n[i];k++) {
6481 pcbddc->primal_indices_local_idxs[total_counts++] = constraints_idxs[constraints_idxs_ptr[i]+k];
6482 nnz[j+k] = size_of_constraint;
6483 }
6484 j += constraints_n[i];
6485 }
6486 }
6487 ierr = MatSeqAIJSetPreallocation(pcbddc->ConstraintMatrix,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6487,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6488 ierr = MatSetOption(pcbddc->ConstraintMatrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6488,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6489 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),6489,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6489,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6490
6491 /* set values in constraint matrix */
6492 for (i=0;i<total_primal_vertices;i++) {
6493 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),6493,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6494 }
6495 total_counts = total_primal_vertices;
6496 for (i=n_vertices;i<total_counts_cc;i++) {
6497 if (!PetscBTLookup(change_basis,i)) {
6498 PetscInt *cols;
6499
6500 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6501 cols = constraints_idxs+constraints_idxs_ptr[i];
6502 for (k=0;k<constraints_n[i];k++) {
6503 PetscInt row = total_counts+k;
6504 PetscScalar *vals;
6505
6506 vals = constraints_data+constraints_data_ptr[i]+k*size_of_constraint;
6507 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),6507,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6508 }
6509 total_counts += constraints_n[i];
6510 }
6511 }
6512 /* assembling */
6513 ierr = MatAssemblyBegin(pcbddc->ConstraintMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6513,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6514 ierr = MatAssemblyEnd(pcbddc->ConstraintMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6514,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6515 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),6515,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6516
6517 /* Create matrix for change of basis. We don't need it in case pcbddc->use_change_of_basis is FALSE */
6518 if (pcbddc->use_change_of_basis) {
6519 /* dual and primal dofs on a single cc */
6520 PetscInt dual_dofs,primal_dofs;
6521 /* working stuff for GEQRF */
6522 PetscScalar *qr_basis = NULL((void*)0),*qr_tau = NULL((void*)0),*qr_work = NULL((void*)0),lqr_work_t;
6523 PetscBLASInt lqr_work;
6524 /* working stuff for UNGQR */
6525 PetscScalar *gqr_work = NULL((void*)0),lgqr_work_t;
6526 PetscBLASInt lgqr_work;
6527 /* working stuff for TRTRS */
6528 PetscScalar *trs_rhs = NULL((void*)0);
6529 PetscBLASInt Blas_NRHS;
6530 /* pointers for values insertion into change of basis matrix */
6531 PetscInt *start_rows,*start_cols;
6532 PetscScalar *start_vals;
6533 /* working stuff for values insertion */
6534 PetscBT is_primal;
6535 PetscInt *aux_primal_numbering_B;
6536 /* matrix sizes */
6537 PetscInt global_size,local_size;
6538 /* temporary change of basis */
6539 Mat localChangeOfBasisMatrix;
6540 /* extra space for debugging */
6541 PetscScalar *dbg_work = NULL((void*)0);
6542
6543 /* local temporary change of basis acts on local interfaces -> dimension is n_B x n_B */
6544 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&localChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6544,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6545 ierr = MatSetType(localChangeOfBasisMatrix,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6545,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6546 ierr = MatSetSizes(localChangeOfBasisMatrix,pcis->n,pcis->n,pcis->n,pcis->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6546,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6547 /* nonzeros for local mat */
6548 ierr = PetscMalloc1(pcis->n,&nnz)PetscMallocA(1,PETSC_FALSE,6548,__func__,"/sandbox/petsc/petsc.master/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),6548,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6549 if (!pcbddc->benign_change || pcbddc->fake_change) {
6550 for (i=0;i<pcis->n;i++) nnz[i]=1;
6551 } else {
6552 const PetscInt *ii;
6553 PetscInt n;
6554 PetscBool flg_row;
6555 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),6555,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6556 for (i=0;i<n;i++) nnz[i] = ii[i+1]-ii[i];
6557 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),6557,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6558 }
6559 for (i=n_vertices;i<total_counts_cc;i++) {
6560 if (PetscBTLookup(change_basis,i)) {
6561 size_of_constraint = constraints_idxs_ptr[i+1]-constraints_idxs_ptr[i];
6562 if (PetscBTLookup(qr_needed_idx,i)) {
6563 for (j=0;j<size_of_constraint;j++) nnz[constraints_idxs[constraints_idxs_ptr[i]+j]] = size_of_constraint;
6564 } else {
6565 nnz[constraints_idxs[constraints_idxs_ptr[i]]] = size_of_constraint;
6566 for (j=1;j<size_of_constraint;j++) nnz[constraints_idxs[constraints_idxs_ptr[i]+j]] = 2;
6567 }
6568 }
6569 }
6570 ierr = MatSeqAIJSetPreallocation(localChangeOfBasisMatrix,0,nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6570,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6571 ierr = MatSetOption(localChangeOfBasisMatrix,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6571,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6572 ierr = PetscFree(nnz)((*PetscTrFree)((void*)(nnz),6572,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((nnz) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6572,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6573 /* Set interior change in the matrix */
6574 if (!pcbddc->benign_change || pcbddc->fake_change) {
6575 for (i=0;i<pcis->n;i++) {
6576 ierr = MatSetValue(localChangeOfBasisMatrix,i,i,1.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6576,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6577 }
6578 } else {
6579 const PetscInt *ii,*jj;
6580 PetscScalar *aa;
6581 PetscInt n;
6582 PetscBool flg_row;
6583 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),6583,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6584 ierr = MatSeqAIJGetArray(pcbddc->benign_change,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6584,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6585 for (i=0;i<n;i++) {
6586 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),6586,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6587 }
6588 ierr = MatSeqAIJRestoreArray(pcbddc->benign_change,&aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6588,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6589 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),6589,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6590 }
6591
6592 if (pcbddc->dbg_flag) {
6593 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"--------------------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6593,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6594 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),6594,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6595 }
6596
6597
6598 /* Now we loop on the constraints which need a change of basis */
6599 /*
6600 Change of basis matrix is evaluated similarly to the FIRST APPROACH in
6601 Klawonn and Widlund, Dual-primal FETI-DP methods for linear elasticity, (see Sect 6.2.1)
6602
6603 Basic blocks of change of basis matrix T computed by
6604
6605 - Using the following block transformation if there is only a primal dof on the cc (and -pc_bddc_use_qr_single is not specified)
6606
6607 | 1 0 ... 0 s_1/S |
6608 | 0 1 ... 0 s_2/S |
6609 | ... |
6610 | 0 ... 1 s_{n-1}/S |
6611 | -s_1/s_n ... -s_{n-1}/s_n s_n/S |
6612
6613 with S = \sum_{i=1}^n s_i^2
6614 NOTE: in the above example, the primal dof is the last one of the edge in LOCAL ordering
6615 in the current implementation, the primal dof is the first one of the edge in GLOBAL ordering
6616
6617 - QR decomposition of constraints otherwise
6618 */
6619 if (qr_needed && max_size_of_constraint) {
6620 /* space to store Q */
6621 ierr = PetscMalloc1(max_size_of_constraint*max_size_of_constraint,&qr_basis)PetscMallocA(1,PETSC_FALSE,6621,__func__,"/sandbox/petsc/petsc.master/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),6621,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6622 /* array to store scaling factors for reflectors */
6623 ierr = PetscMalloc1(max_constraints,&qr_tau)PetscMallocA(1,PETSC_FALSE,6623,__func__,"/sandbox/petsc/petsc.master/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),6623,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6624 /* first we issue queries for optimal work */
6625 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6625,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6626 ierr = PetscBLASIntCast(max_constraints,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6626,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6627 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6627,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6628 lqr_work = -1;
6629 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6629; 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(6629,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6629,__func__,"/sandbox/petsc/petsc.master/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)
;
6630 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in query to GEQRF Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6630,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to GEQRF Lapack routine %d"
,(int)lierr)
;
6631 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),6631,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6632 ierr = PetscMalloc1((PetscInt)PetscRealPart(lqr_work_t),&qr_work)PetscMallocA(1,PETSC_FALSE,6632,__func__,"/sandbox/petsc/petsc.master/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),6632,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6633 lgqr_work = -1;
6634 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6634,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6635 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6635,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6636 ierr = PetscBLASIntCast(max_constraints,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6636,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6637 ierr = PetscBLASIntCast(max_size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6637,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6638 if (Blas_K>Blas_M) Blas_K=Blas_M; /* adjust just for computing optimal work */
6639 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6639; 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(6639,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6639,__func__,"/sandbox/petsc/petsc.master/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)
;
6640 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),6640,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in query to ORGQR/UNGQR Lapack routine %d"
,(int)lierr)
;
6641 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),6641,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6642 ierr = PetscMalloc1((PetscInt)PetscRealPart(lgqr_work_t),&gqr_work)PetscMallocA(1,PETSC_FALSE,6642,__func__,"/sandbox/petsc/petsc.master/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),6642,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6643 /* array to store rhs and solution of triangular solver */
6644 ierr = PetscMalloc1(max_constraints*max_constraints,&trs_rhs)PetscMallocA(1,PETSC_FALSE,6644,__func__,"/sandbox/petsc/petsc.master/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),6644,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6645 /* allocating workspace for check */
6646 if (pcbddc->dbg_flag) {
6647 ierr = PetscMalloc1(max_size_of_constraint*(max_constraints+max_size_of_constraint),&dbg_work)PetscMallocA(1,PETSC_FALSE,6647,__func__,"/sandbox/petsc/petsc.master/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),6647,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6648 }
6649 }
6650 /* array to store whether a node is primal or not */
6651 ierr = PetscBTCreate(pcis->n_B,&is_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6651,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6652 ierr = PetscMalloc1(total_primal_vertices,&aux_primal_numbering_B)PetscMallocA(1,PETSC_FALSE,6652,__func__,"/sandbox/petsc/petsc.master/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),6652,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6653 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),6653,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6654 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),6654,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error in boundary numbering for BDDC vertices! %D != %D"
,total_primal_vertices,i)
;
6655 for (i=0;i<total_primal_vertices;i++) {
6656 ierr = PetscBTSet(is_primal,aux_primal_numbering_B[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6656,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6657 }
6658 ierr = PetscFree(aux_primal_numbering_B)((*PetscTrFree)((void*)(aux_primal_numbering_B),6658,__func__
,"/sandbox/petsc/petsc.master/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),6658,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6659
6660 /* loop on constraints and see whether or not they need a change of basis and compute it */
6661 for (total_counts=n_vertices;total_counts<total_counts_cc;total_counts++) {
6662 size_of_constraint = constraints_idxs_ptr[total_counts+1]-constraints_idxs_ptr[total_counts];
6663 if (PetscBTLookup(change_basis,total_counts)) {
6664 /* get constraint info */
6665 primal_dofs = constraints_n[total_counts];
6666 dual_dofs = size_of_constraint-primal_dofs;
6667
6668 if (pcbddc->dbg_flag) {
6669 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),6669,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6670 }
6671
6672 if (PetscBTLookup(qr_needed_idx,total_counts)) { /* QR */
6673
6674 /* copy quadrature constraints for change of basis check */
6675 if (pcbddc->dbg_flag) {
6676 ierr = PetscArraycpy(dbg_work,&constraints_data[constraints_data_ptr[total_counts]],size_of_constraint*primal_dofs)((sizeof(*(dbg_work)) != sizeof(*(&constraints_data[constraints_data_ptr
[total_counts]]))) || PetscMemcpy(dbg_work,&constraints_data
[constraints_data_ptr[total_counts]],(size_of_constraint*primal_dofs
)*sizeof(*(dbg_work))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6676,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6677 }
6678 /* copy temporary constraints into larger work vector (in order to store all columns of Q) */
6679 ierr = PetscArraycpy(qr_basis,&constraints_data[constraints_data_ptr[total_counts]],size_of_constraint*primal_dofs)((sizeof(*(qr_basis)) != sizeof(*(&constraints_data[constraints_data_ptr
[total_counts]]))) || PetscMemcpy(qr_basis,&constraints_data
[constraints_data_ptr[total_counts]],(size_of_constraint*primal_dofs
)*sizeof(*(qr_basis))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6679,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6680
6681 /* compute QR decomposition of constraints */
6682 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6683 ierr = PetscBLASIntCast(primal_dofs,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6683,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6684 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6684,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6685 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6685,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6686 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6686; 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(6686,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6686,__func__,"/sandbox/petsc/petsc.master/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)
;
6687 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in GEQRF Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6687,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in GEQRF Lapack routine %d",(int
)lierr)
;
6688 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6688,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6689
6690 /* explictly compute R^-T */
6691 ierr = PetscArrayzero(trs_rhs,primal_dofs*primal_dofs)PetscMemzero(trs_rhs,(primal_dofs*primal_dofs)*sizeof(*(trs_rhs
)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6691,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6692 for (j=0;j<primal_dofs;j++) trs_rhs[j*(primal_dofs+1)] = 1.0;
6693 ierr = PetscBLASIntCast(primal_dofs,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6693,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6694 ierr = PetscBLASIntCast(primal_dofs,&Blas_NRHS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6694,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6695 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6695,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6696 ierr = PetscBLASIntCast(primal_dofs,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6696,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6697 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6697,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6698 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6698; 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(6698,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6698,__func__,"/sandbox/petsc/petsc.master/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)
;
6699 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in TRTRS Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6699,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in TRTRS Lapack routine %d",(int
)lierr)
;
6700 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6700,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6701
6702 /* explicitly compute all columns of Q (Q = [Q1 | Q2] ) overwriting QR factorization in qr_basis */
6703 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6703,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6704 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6704,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6705 ierr = PetscBLASIntCast(primal_dofs,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6705,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6706 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6706,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6707 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6707,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6708 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6708; 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(6708,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6708,__func__,"/sandbox/petsc/petsc.master/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)
;
6709 if (lierr) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in ORGQR/UNGQR Lapack routine %d",(int)lierr)return PetscError(((MPI_Comm)0x44000001),6709,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,76,PETSC_ERROR_INITIAL,"Error in ORGQR/UNGQR Lapack routine %d"
,(int)lierr)
;
6710 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6710,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6711
6712 /* first primal_dofs columns of Q need to be re-scaled in order to be unitary w.r.t constraints
6713 i.e. C_{pxn}*Q_{nxn} should be equal to [I_pxp | 0_pxd] (see check below)
6714 where n=size_of_constraint, p=primal_dofs, d=dual_dofs (n=p+d), I and 0 identity and null matrix resp. */
6715 ierr = PetscBLASIntCast(size_of_constraint,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6715,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6716 ierr = PetscBLASIntCast(primal_dofs,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6716,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6717 ierr = PetscBLASIntCast(primal_dofs,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6717,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6718 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6718,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6719 ierr = PetscBLASIntCast(primal_dofs,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6719,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6720 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6720,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6721 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6721,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6722 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6722; 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(6722,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6722,__func__,"/sandbox/petsc/petsc.master/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)
;
6723 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6723,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6724 ierr = PetscArraycpy(qr_basis,&constraints_data[constraints_data_ptr[total_counts]],size_of_constraint*primal_dofs)((sizeof(*(qr_basis)) != sizeof(*(&constraints_data[constraints_data_ptr
[total_counts]]))) || PetscMemcpy(qr_basis,&constraints_data
[constraints_data_ptr[total_counts]],(size_of_constraint*primal_dofs
)*sizeof(*(qr_basis))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6724,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6725
6726 /* insert values in change of basis matrix respecting global ordering of new primal dofs */
6727 start_rows = &constraints_idxs[constraints_idxs_ptr[total_counts]];
6728 /* insert cols for primal dofs */
6729 for (j=0;j<primal_dofs;j++) {
6730 start_vals = &qr_basis[j*size_of_constraint];
6731 start_cols = &constraints_idxs[constraints_idxs_ptr[total_counts]+j];
6732 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),6732,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6733 }
6734 /* insert cols for dual dofs */
6735 for (j=0,k=0;j<dual_dofs;k++) {
6736 if (!PetscBTLookup(is_primal,constraints_idxs_B[constraints_idxs_ptr[total_counts]+k])) {
6737 start_vals = &qr_basis[(primal_dofs+j)*size_of_constraint];
6738 start_cols = &constraints_idxs[constraints_idxs_ptr[total_counts]+k];
6739 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),6739,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6740 j++;
6741 }
6742 }
6743
6744 /* check change of basis */
6745 if (pcbddc->dbg_flag) {
6746 PetscInt ii,jj;
6747 PetscBool valid_qr=PETSC_TRUE;
6748 ierr = PetscBLASIntCast(primal_dofs,&Blas_M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6748,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6749 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6749,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6750 ierr = PetscBLASIntCast(size_of_constraint,&Blas_K);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6750,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6751 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6751,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6752 ierr = PetscBLASIntCast(size_of_constraint,&Blas_LDB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6752,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6753 ierr = PetscBLASIntCast(primal_dofs,&Blas_LDC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6753,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6754 ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6754,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6755 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6755; 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(6755,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6755,__func__,"/sandbox/petsc/petsc.master/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)
;
6756 ierr = PetscFPTrapPop();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6756,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6757 for (jj=0;jj<size_of_constraint;jj++) {
6758 for (ii=0;ii<primal_dofs;ii++) {
6759 if (ii != jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii])fabs(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii
])
> 1.e-12) valid_qr = PETSC_FALSE;
6760 if (ii == jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]-(PetscReal)1)fabs(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii
]-(PetscReal)1)
> 1.e-12) valid_qr = PETSC_FALSE;
6761 }
6762 }
6763 if (!valid_qr) {
6764 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"\t-> wrong change of basis!\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6764,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6765 for (jj=0;jj<size_of_constraint;jj++) {
6766 for (ii=0;ii<primal_dofs;ii++) {
6767 if (ii != jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii])fabs(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii
])
> 1.e-12) {
6768 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])fabs(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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6769 }
6770 if (ii == jj && PetscAbsScalar(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii]-(PetscReal)1)fabs(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii
]-(PetscReal)1)
> 1.e-12) {
6771 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])fabs(dbg_work[size_of_constraint*primal_dofs+jj*primal_dofs+ii
])
);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6771,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6772 }
6773 }
6774 }
6775 } else {
6776 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"\t-> right change of basis!\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6776,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6777 }
6778 }
6779 } else { /* simple transformation block */
6780 PetscInt row,col;
6781 PetscScalar val,norm;
6782
6783 ierr = PetscBLASIntCast(size_of_constraint,&Blas_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6783,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6784 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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 6784; 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(6784,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
);do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError(
((MPI_Comm)0x44000001),6784,__func__,"/sandbox/petsc/petsc.master/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)
;
6785 for (j=0;j<size_of_constraint;j++) {
6786 PetscInt row_B = constraints_idxs_B[constraints_idxs_ptr[total_counts]+j];
6787 row = constraints_idxs[constraints_idxs_ptr[total_counts]+j];
6788 if (!PetscBTLookup(is_primal,row_B)) {
6789 col = constraints_idxs[constraints_idxs_ptr[total_counts]];
6790 ierr = MatSetValue(localChangeOfBasisMatrix,row,row,1.0,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6790,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6791 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),6791,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6792 } else {
6793 for (k=0;k<size_of_constraint;k++) {
6794 col = constraints_idxs[constraints_idxs_ptr[total_counts]+k];
6795 if (row != col) {
6796 val = -constraints_data[constraints_data_ptr[total_counts]+k]/constraints_data[constraints_data_ptr[total_counts]];
6797 } else {
6798 val = constraints_data[constraints_data_ptr[total_counts]]/norm;
6799 }
6800 ierr = MatSetValue(localChangeOfBasisMatrix,row,col,val,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6800,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6801 }
6802 }
6803 }
6804 if (pcbddc->dbg_flag) {
6805 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),6805,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6806 }
6807 }
6808 } else {
6809 if (pcbddc->dbg_flag) {
6810 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),6810,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6811 }
6812 }
6813 }
6814
6815 /* free workspace */
6816 if (qr_needed) {
6817 if (pcbddc->dbg_flag) {
6818 ierr = PetscFree(dbg_work)((*PetscTrFree)((void*)(dbg_work),6818,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((dbg_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6818,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6819 }
6820 ierr = PetscFree(trs_rhs)((*PetscTrFree)((void*)(trs_rhs),6820,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((trs_rhs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6820,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6821 ierr = PetscFree(qr_tau)((*PetscTrFree)((void*)(qr_tau),6821,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((qr_tau) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6821,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6822 ierr = PetscFree(qr_work)((*PetscTrFree)((void*)(qr_work),6822,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((qr_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6822,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6823 ierr = PetscFree(gqr_work)((*PetscTrFree)((void*)(gqr_work),6823,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((gqr_work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6823,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6824 ierr = PetscFree(qr_basis)((*PetscTrFree)((void*)(qr_basis),6824,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((qr_basis) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6824,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6825 }
6826 ierr = PetscBTDestroy(&is_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6826,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6827 ierr = MatAssemblyBegin(localChangeOfBasisMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6827,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6828 ierr = MatAssemblyEnd(localChangeOfBasisMatrix,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6828,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6829
6830 /* assembling of global change of variable */
6831 if (!pcbddc->fake_change) {
6832 Mat tmat;
6833 PetscInt bs;
6834
6835 ierr = VecGetSize(pcis->vec1_global,&global_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6835,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6836 ierr = VecGetLocalSize(pcis->vec1_global,&local_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6836,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6837 ierr = MatDuplicate(pc->pmat,MAT_DO_NOT_COPY_VALUES,&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6837,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6838 ierr = MatISSetLocalMat(tmat,localChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6838,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6839 ierr = MatAssemblyBegin(tmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6839,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6840 ierr = MatAssemblyEnd(tmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6840,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6841 ierr = MatCreate(PetscObjectComm((PetscObject)pc),&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6841,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6842 ierr = MatSetType(pcbddc->ChangeOfBasisMatrix,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6842,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6843 ierr = MatGetBlockSize(pc->pmat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6843,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6844 ierr = MatSetBlockSize(pcbddc->ChangeOfBasisMatrix,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6844,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6845 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),6845,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6846 ierr = MatISSetMPIXAIJPreallocation_Private(tmat,pcbddc->ChangeOfBasisMatrix,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6846,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6847 ierr = MatConvert(tmat,MATAIJ"aij",MAT_REUSE_MATRIX,&pcbddc->ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6847,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6848 ierr = MatDestroy(&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6848,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6849 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6849,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6850 ierr = VecSet(pcis->vec1_N,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6850,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6851 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),6851,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6852 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),6852,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6853 ierr = VecReciprocal(pcis->vec1_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6853,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6854 ierr = MatDiagonalScale(pcbddc->ChangeOfBasisMatrix,pcis->vec1_global,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6854,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6855
6856 /* check */
6857 if (pcbddc->dbg_flag) {
6858 PetscReal error;
6859 Vec x,x_change;
6860
6861 ierr = VecDuplicate(pcis->vec1_global,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6861,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6862 ierr = VecDuplicate(pcis->vec1_global,&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6862,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6863 ierr = VecSetRandom(x,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6863,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6864 ierr = VecCopy(x,pcis->vec1_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6864,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6865 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),6865,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6866 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),6866,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6867 ierr = MatMult(localChangeOfBasisMatrix,pcis->vec1_N,pcis->vec2_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6867,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6868 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),6868,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6869 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),6869,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6870 ierr = MatMult(pcbddc->ChangeOfBasisMatrix,pcis->vec1_global,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6870,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6871 ierr = VecAXPY(x,-1.0,x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6871,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6872 ierr = VecNorm(x,NORM_INFINITY,&error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6872,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6873 if (error > PETSC_SMALL1.e-10) {
6874 SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"Error global vs local change on N: %1.6e",error)return PetscError(PetscObjectComm((PetscObject)pc),6874,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Error global vs local change on N: %1.6e"
,error)
;
6875 }
6876 ierr = VecDestroy(&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6876,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6877 ierr = VecDestroy(&x_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6877,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6878 }
6879 /* adapt sub_schurs computed (if any) */
6880 if (pcbddc->use_deluxe_scaling) {
6881 PCBDDCSubSchurs sub_schurs=pcbddc->sub_schurs;
6882
6883 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),6883,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot mix automatic change of basis, adaptive selection and user-defined constraints"
)
;
6884 if (sub_schurs && sub_schurs->S_Ej_all) {
6885 Mat S_new,tmat;
6886 IS is_all_N,is_V_Sall = NULL((void*)0);
6887
6888 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),6888,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6889 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),6889,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6890 if (pcbddc->deluxe_zerorows) {
6891 ISLocalToGlobalMapping NtoSall;
6892 IS is_V;
6893 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),6893,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6894 ierr = ISLocalToGlobalMappingCreateIS(is_all_N,&NtoSall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6894,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6895 ierr = ISGlobalToLocalMappingApplyIS(NtoSall,IS_GTOLM_DROP,is_V,&is_V_Sall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6895,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6896 ierr = ISLocalToGlobalMappingDestroy(&NtoSall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6896,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6897 ierr = ISDestroy(&is_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6897,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6898 }
6899 ierr = ISDestroy(&is_all_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6899,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6900 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),6900,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6901 ierr = MatDestroy(&sub_schurs->S_Ej_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6901,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6902 ierr = PetscObjectReference((PetscObject)S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6902,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6903 if (pcbddc->deluxe_zerorows) {
6904 const PetscScalar *array;
6905 const PetscInt *idxs_V,*idxs_all;
6906 PetscInt i,n_V;
6907
6908 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),6908,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6909 ierr = ISGetLocalSize(is_V_Sall,&n_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6909,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6910 ierr = ISGetIndices(is_V_Sall,&idxs_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6910,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6911 ierr = ISGetIndices(sub_schurs->is_Ej_all,&idxs_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6911,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6912 ierr = VecGetArrayRead(pcis->D,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6912,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6913 for (i=0;i<n_V;i++) {
6914 PetscScalar val;
6915 PetscInt idx;
6916
6917 idx = idxs_V[i];
6918 val = array[idxs_all[idxs_V[i]]];
6919 ierr = MatSetValue(S_new,idx,idx,val,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6919,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6920 }
6921 ierr = MatAssemblyBegin(S_new,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6921,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6922 ierr = MatAssemblyEnd(S_new,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6922,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6923 ierr = VecRestoreArrayRead(pcis->D,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6923,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6924 ierr = ISRestoreIndices(sub_schurs->is_Ej_all,&idxs_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6924,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6925 ierr = ISRestoreIndices(is_V_Sall,&idxs_V);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6925,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6926 }
6927 sub_schurs->S_Ej_all = S_new;
6928 ierr = MatDestroy(&S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6928,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6929 if (sub_schurs->sum_S_Ej_all) {
6930 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),6930,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6931 ierr = MatDestroy(&sub_schurs->sum_S_Ej_all);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6931,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6932 ierr = PetscObjectReference((PetscObject)S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6932,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6933 if (pcbddc->deluxe_zerorows) {
6934 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),6934,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6935 }
6936 sub_schurs->sum_S_Ej_all = S_new;
6937 ierr = MatDestroy(&S_new);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6937,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6938 }
6939 ierr = ISDestroy(&is_V_Sall);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6939,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6940 ierr = MatDestroy(&tmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6940,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6941 }
6942 /* destroy any change of basis context in sub_schurs */
6943 if (sub_schurs && sub_schurs->change) {
6944 PetscInt i;
6945
6946 for (i=0;i<sub_schurs->n_subs;i++) {
6947 ierr = KSPDestroy(&sub_schurs->change[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6947,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6948 }
6949 ierr = PetscFree(sub_schurs->change)((*PetscTrFree)((void*)(sub_schurs->change),6949,__func__,
"/sandbox/petsc/petsc.master/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),6949,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6950 }
6951 }
6952 if (pcbddc->switch_static) { /* need to save the local change */
6953 pcbddc->switch_static_change = localChangeOfBasisMatrix;
6954 } else {
6955 ierr = MatDestroy(&localChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6955,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6956 }
6957 /* determine if any process has changed the pressures locally */
6958 pcbddc->change_interior = pcbddc->benign_have_null;
6959 } else { /* fake change (get back change of basis into ConstraintMatrix and info on qr) */
6960 ierr = MatDestroy(&pcbddc->ConstraintMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6960,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6961 pcbddc->ConstraintMatrix = localChangeOfBasisMatrix;
6962 pcbddc->use_qr_single = qr_needed;
6963 }
6964 } else if (pcbddc->user_ChangeOfBasisMatrix || pcbddc->benign_saddle_point) {
6965 if (!pcbddc->benign_have_null && pcbddc->user_ChangeOfBasisMatrix) {
6966 ierr = PetscObjectReference((PetscObject)pcbddc->user_ChangeOfBasisMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6966,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6967 pcbddc->ChangeOfBasisMatrix = pcbddc->user_ChangeOfBasisMatrix;
6968 } else {
6969 Mat benign_global = NULL((void*)0);
6970 if (pcbddc->benign_have_null) {
6971 Mat M;
6972
6973 pcbddc->change_interior = PETSC_TRUE;
6974 ierr = VecCopy(matis->counter,pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6974,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6975 ierr = VecReciprocal(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6975,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6976 ierr = MatDuplicate(pc->pmat,MAT_DO_NOT_COPY_VALUES,&benign_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6976,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6977 if (pcbddc->benign_change) {
6978 ierr = MatDuplicate(pcbddc->benign_change,MAT_COPY_VALUES,&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6978,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6979 ierr = MatDiagonalScale(M,pcis->vec1_N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6979,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6980 } else {
6981 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),6981,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6982 ierr = MatDiagonalSet(M,pcis->vec1_N,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6982,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6983 }
6984 ierr = MatISSetLocalMat(benign_global,M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6984,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6985 ierr = MatDestroy(&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6985,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6986 ierr = MatAssemblyBegin(benign_global,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6986,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6987 ierr = MatAssemblyEnd(benign_global,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6987,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6988 }
6989 if (pcbddc->user_ChangeOfBasisMatrix) {
6990 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),6990,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6991 ierr = MatDestroy(&benign_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6991,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6992 } else if (pcbddc->benign_have_null) {
6993 pcbddc->ChangeOfBasisMatrix = benign_global;
6994 }
6995 }
6996 if (pcbddc->switch_static && pcbddc->ChangeOfBasisMatrix) { /* need to save the local change */
6997 IS is_global;
6998 const PetscInt *gidxs;
6999
7000 ierr = ISLocalToGlobalMappingGetIndices(pc->pmat->rmap->mapping,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7000,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7001 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),7001,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7002 ierr = ISLocalToGlobalMappingRestoreIndices(pc->pmat->rmap->mapping,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7002,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7003 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),7003,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7004 ierr = ISDestroy(&is_global);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7004,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7005 }
7006 }
7007 if (!pcbddc->fake_change && pcbddc->ChangeOfBasisMatrix && !pcbddc->work_change) {
7008 ierr = VecDuplicate(pcis->vec1_global,&pcbddc->work_change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7008,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7009 }
7010
7011 if (!pcbddc->fake_change) {
7012 /* add pressure dofs to set of primal nodes for numbering purposes */
7013 for (i=0;i<pcbddc->benign_n;i++) {
7014 pcbddc->local_primal_ref_node[pcbddc->local_primal_size_cc] = pcbddc->benign_p0_lidx[i];
7015 pcbddc->primal_indices_local_idxs[pcbddc->local_primal_size] = pcbddc->benign_p0_lidx[i];
7016 pcbddc->local_primal_ref_mult[pcbddc->local_primal_size_cc] = 1;
7017 pcbddc->local_primal_size_cc++;
7018 pcbddc->local_primal_size++;
7019 }
7020
7021 /* check if a new primal space has been introduced (also take into account benign trick) */
7022 pcbddc->new_primal_space_local = PETSC_TRUE;
7023 if (olocal_primal_size == pcbddc->local_primal_size) {
7024 ierr = PetscArraycmp(pcbddc->local_primal_ref_node,olocal_primal_ref_node,olocal_primal_size_cc,&pcbddc->new_primal_space_local)((sizeof(*(pcbddc->local_primal_ref_node)) != sizeof(*(olocal_primal_ref_node
))) || PetscMemcmp(pcbddc->local_primal_ref_node,olocal_primal_ref_node
,(olocal_primal_size_cc)*sizeof(*(pcbddc->local_primal_ref_node
)),&pcbddc->new_primal_space_local))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7024,__func__,"/sandbox/petsc/petsc.master/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 if (!pcbddc->new_primal_space_local) {
7027 ierr = PetscArraycmp(pcbddc->local_primal_ref_mult,olocal_primal_ref_mult,olocal_primal_size_cc,&pcbddc->new_primal_space_local)((sizeof(*(pcbddc->local_primal_ref_mult)) != sizeof(*(olocal_primal_ref_mult
))) || PetscMemcmp(pcbddc->local_primal_ref_mult,olocal_primal_ref_mult
,(olocal_primal_size_cc)*sizeof(*(pcbddc->local_primal_ref_mult
)),&pcbddc->new_primal_space_local))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7027,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7028 pcbddc->new_primal_space_local = (PetscBool)(!pcbddc->new_primal_space_local);
7029 }
7030 }
7031 /* new_primal_space will be used for numbering of coarse dofs, so it should be the same across all subdomains */
7032 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,7032,__func__,"/sandbox/petsc/petsc.master/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),7032,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7033 }
7034 ierr = PetscFree2(olocal_primal_ref_node,olocal_primal_ref_mult)PetscFreeA(2,7034,__func__,"/sandbox/petsc/petsc.master/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),7034,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7035
7036 /* flush dbg viewer */
7037 if (pcbddc->dbg_flag) {
7038 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7038,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7039 }
7040
7041 /* free workspace */
7042 ierr = PetscBTDestroy(&qr_needed_idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7042,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7043 ierr = PetscBTDestroy(&change_basis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7043,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7044 if (!pcbddc->adaptive_selection) {
7045 ierr = PetscFree3(constraints_idxs_ptr,constraints_data_ptr,constraints_n)PetscFreeA(3,7045,__func__,"/sandbox/petsc/petsc.master/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),7045,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7046 ierr = PetscFree3(constraints_data,constraints_idxs,constraints_idxs_B)PetscFreeA(3,7046,__func__,"/sandbox/petsc/petsc.master/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),7046,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7047 } else {
7048 ierr = PetscFree5(pcbddc->adaptive_constraints_n,PetscFreeA(5,7052,__func__,"/sandbox/petsc/petsc.master/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_idxs_ptr,PetscFreeA(5,7052,__func__,"/sandbox/petsc/petsc.master/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
))
7050 pcbddc->adaptive_constraints_data_ptr,PetscFreeA(5,7052,__func__,"/sandbox/petsc/petsc.master/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
))
7051 pcbddc->adaptive_constraints_idxs,PetscFreeA(5,7052,__func__,"/sandbox/petsc/petsc.master/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
))
7052 pcbddc->adaptive_constraints_data)PetscFreeA(5,7052,__func__,"/sandbox/petsc/petsc.master/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),7052,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7053 ierr = PetscFree(constraints_n)((*PetscTrFree)((void*)(constraints_n),7053,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((constraints_n) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7053,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7054 ierr = PetscFree(constraints_idxs_B)((*PetscTrFree)((void*)(constraints_idxs_B),7054,__func__,"/sandbox/petsc/petsc.master/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),7054,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7055 }
7056 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7057}
7058/* #undef PETSC_MISSING_LAPACK_GESVD */
7059
7060PetscErrorCode PCBDDCAnalyzeInterface(PC pc)
7061{
7062 ISLocalToGlobalMapping map;
7063 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
7064 Mat_IS *matis = (Mat_IS*)pc->pmat->data;
7065 PetscInt i,N;
7066 PetscBool rcsr = PETSC_FALSE;
7067 PetscErrorCode ierr;
7068
7069 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7069; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7070 if (pcbddc->recompute_topography) {
7071 pcbddc->graphanalyzed = PETSC_FALSE;
7072 /* Reset previously computed graph */
7073 ierr = PCBDDCGraphReset(pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7073,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7074 /* Init local Graph struct */
7075 ierr = MatGetSize(pc->pmat,&N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7075,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7076 ierr = MatGetLocalToGlobalMapping(pc->pmat,&map,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7076,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7077 ierr = PCBDDCGraphInit(pcbddc->mat_graph,map,N,pcbddc->graphmaxcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7077,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7078
7079 if (pcbddc->user_primal_vertices_local && !pcbddc->user_primal_vertices) {
7080 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),7080,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7081 }
7082 /* Check validity of the csr graph passed in by the user */
7083 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),7083,__func__,"/sandbox/petsc/petsc.master/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)
;
7084
7085 /* Set default CSR adjacency of local dofs if not provided by the user with PCBDDCSetLocalAdjacencyGraph */
7086 if (!pcbddc->mat_graph->xadj && pcbddc->use_local_adj) {
7087 PetscInt *xadj,*adjncy;
7088 PetscInt nvtxs;
7089 PetscBool flg_row=PETSC_FALSE;
7090
7091 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),7091,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7092 if (flg_row) {
7093 ierr = PCBDDCSetLocalAdjacencyGraph(pc,nvtxs,xadj,adjncy,PETSC_COPY_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7093,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7094 pcbddc->computed_rowadj = PETSC_TRUE;
7095 }
7096 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),7096,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7097 rcsr = PETSC_TRUE;
7098 }
7099 if (pcbddc->dbg_flag) {
7100 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7100,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7101 }
7102
7103 if (pcbddc->mat_graph->cdim && !pcbddc->mat_graph->cloc) {
7104 PetscReal *lcoords;
7105 PetscInt n;
7106 MPI_Datatype dimrealtype;
7107
7108 /* TODO: support for blocked */
7109 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),7109,__func__,"/sandbox/petsc/petsc.master/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)
;
7110 ierr = MatGetLocalSize(matis->A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7110,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7111 ierr = PetscMalloc1(pcbddc->mat_graph->cdim*n,&lcoords)PetscMallocA(1,PETSC_FALSE,7111,__func__,"/sandbox/petsc/petsc.master/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),7111,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7112 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),7112,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7113 ierr = MPI_Type_commit(&dimrealtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7113,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7114 ierr = PetscSFBcastBegin(matis->sf,dimrealtype,pcbddc->mat_graph->coords,lcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7114,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7115 ierr = PetscSFBcastEnd(matis->sf,dimrealtype,pcbddc->mat_graph->coords,lcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7115,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7116 ierr = MPI_Type_free(&dimrealtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7116,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7117 ierr = PetscFree(pcbddc->mat_graph->coords)((*PetscTrFree)((void*)(pcbddc->mat_graph->coords),7117
,__func__,"/sandbox/petsc/petsc.master/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),7117,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7118
7119 pcbddc->mat_graph->coords = lcoords;
7120 pcbddc->mat_graph->cloc = PETSC_TRUE;
7121 pcbddc->mat_graph->cnloc = n;
7122 }
7123 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),7123,__func__,"/sandbox/petsc/petsc.master/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
)
;
7124 pcbddc->mat_graph->active_coords = (PetscBool)(pcbddc->corner_selection && !pcbddc->corner_selected);
7125
7126 /* Setup of Graph */
7127 pcbddc->mat_graph->commsizelimit = 0; /* don't use the COMM_SELF variant of the graph */
7128 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),7128,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7129
7130 /* attach info on disconnected subdomains if present */
7131 if (pcbddc->n_local_subs) {
7132 PetscInt *local_subs,n,totn;
7133
7134 ierr = MatGetLocalSize(matis->A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7134,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7135 ierr = PetscMalloc1(n,&local_subs)PetscMallocA(1,PETSC_FALSE,7135,__func__,"/sandbox/petsc/petsc.master/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),7135,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7136 for (i=0;i<n;i++) local_subs[i] = pcbddc->n_local_subs;
7137 for (i=0;i<pcbddc->n_local_subs;i++) {
7138 const PetscInt *idxs;
7139 PetscInt nl,j;
7140
7141 ierr = ISGetLocalSize(pcbddc->local_subs[i],&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7141,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7142 ierr = ISGetIndices(pcbddc->local_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7142,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7143 for (j=0;j<nl;j++) local_subs[idxs[j]] = i;
7144 ierr = ISRestoreIndices(pcbddc->local_subs[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7144,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7145 }
7146 for (i=0,totn=0;i<n;i++) totn = PetscMax(totn,local_subs[i])(((totn)<(local_subs[i])) ? (local_subs[i]) : (totn));
7147 pcbddc->mat_graph->n_local_subs = totn + 1;
7148 pcbddc->mat_graph->local_subs = local_subs;
7149 }
7150 }
7151
7152 if (!pcbddc->graphanalyzed) {
7153 /* Graph's connected components analysis */
7154 ierr = PCBDDCGraphComputeConnectedComponents(pcbddc->mat_graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7154,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7155 pcbddc->graphanalyzed = PETSC_TRUE;
7156 pcbddc->corner_selected = pcbddc->corner_selection;
7157 }
7158 if (rcsr) pcbddc->mat_graph->nvtxs_csr = 0;
7159 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7160}
7161
7162PetscErrorCode PCBDDCOrthonormalizeVecs(PetscInt n, Vec vecs[])
7163{
7164 PetscInt i,j;
7165 PetscScalar *alphas;
7166 PetscReal norm;
7167 PetscErrorCode ierr;
7168
7169 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7169; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7170 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)
;
7171 ierr = PetscMalloc1(n,&alphas)PetscMallocA(1,PETSC_FALSE,7171,__func__,"/sandbox/petsc/petsc.master/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),7171,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7172 ierr = VecNormalize(vecs[0],&norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7172,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7173 if (norm < PETSC_SMALL1.e-10) {
7174 ierr = VecSet(vecs[0],0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7174,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7175 }
7176 for (i=1;i<n;i++) {
7177 ierr = VecMDot(vecs[i],i,vecs,alphas);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7177,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7178 for (j=0;j<i;j++) alphas[j] = PetscConj(-alphas[j])(-alphas[j]);
7179 ierr = VecMAXPY(vecs[i],i,alphas,vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7179,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7180 ierr = VecNormalize(vecs[i],&norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7180,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7181 if (norm < PETSC_SMALL1.e-10) {
7182 ierr = VecSet(vecs[i],0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7182,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7183 }
7184 }
7185 ierr = PetscFree(alphas)((*PetscTrFree)((void*)(alphas),7185,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((alphas) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7185,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7186 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7187}
7188
7189PetscErrorCode PCBDDCMatISGetSubassemblingPattern(Mat mat, PetscInt *n_subdomains, PetscInt redprocs, IS* is_sends, PetscBool *have_void)
7190{
7191 Mat A;
7192 PetscInt n_neighs,*neighs,*n_shared,**shared;
7193 PetscMPIInt size,rank,color;
7194 PetscInt *xadj,*adjncy;
7195 PetscInt *adjncy_wgt,*v_wgt,*ranks_send_to_idx;
7196 PetscInt im_active,active_procs,N,n,i,j,threshold = 2;
7197 PetscInt void_procs,*procs_candidates = NULL((void*)0);
7198 PetscInt xadj_count,*count;
7199 PetscBool ismatis,use_vwgt=PETSC_FALSE;
7200 PetscSubcomm psubcomm;
7201 MPI_Comm subcomm;
7202 PetscErrorCode ierr;
7203
7204 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7204; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7205 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),7205,
__func__,"/sandbox/petsc/petsc.master/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),7205,__func__,"/sandbox/petsc/petsc.master/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),7205,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7205,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
7206 ierr = PetscObjectTypeCompare((PetscObject)mat,MATIS"is",&ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7206,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7207 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),7207,__func__
,"/sandbox/petsc/petsc.master/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__)
;
7208 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,7208,__func__,"/sandbox/petsc/petsc.master/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),7208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7208
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
7209 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,7209,__func__,"/sandbox/petsc/petsc.master/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),7209,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7209
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,3); } while (0)
;
7210 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),7210,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Invalid number of subdomains requested %D"
,*n_subdomains)
;
7211
7212 if (have_void) *have_void = PETSC_FALSE;
7213 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)mat),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7213,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7214 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7214,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7215 ierr = MatISGetLocalMat(mat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7215,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7216 ierr = MatGetLocalSize(A,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7216,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7217 im_active = !!n;
7218 ierr = MPIU_Allreduce(&im_active,&active_procs,1,MPIU_INT,MPI_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat)
,1,7218,__func__,"/sandbox/petsc/petsc.master/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),7218,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7219 void_procs = size - active_procs;
7220 /* get ranks of of non-active processes in mat communicator */
7221 if (void_procs) {
7222 PetscInt ncand;
7223
7224 if (have_void) *have_void = PETSC_TRUE;
7225 ierr = PetscMalloc1(size,&procs_candidates)PetscMallocA(1,PETSC_FALSE,7225,__func__,"/sandbox/petsc/petsc.master/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),7225,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7226 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),7226,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7227 for (i=0,ncand=0;i<size;i++) {
7228 if (!procs_candidates[i]) {
7229 procs_candidates[ncand++] = i;
7230 }
7231 }
7232 /* force n_subdomains to be not greater that the number of non-active processes */
7233 *n_subdomains = PetscMin(void_procs,*n_subdomains)(((void_procs)<(*n_subdomains)) ? (void_procs) : (*n_subdomains
))
;
7234 }
7235
7236 /* number of subdomains requested greater than active processes or matrix size -> just shift the matrix
7237 number of subdomains requested 1 -> send to master or first candidate in voids */
7238 ierr = MatGetSize(mat,&N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7238,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7239 if (active_procs < *n_subdomains || *n_subdomains == 1 || N <= *n_subdomains) {
7240 PetscInt issize,isidx,dest;
7241 if (*n_subdomains == 1) dest = 0;
7242 else dest = rank;
7243 if (im_active) {
7244 issize = 1;
7245 if (procs_candidates) { /* shift the pattern on non-active candidates (if any) */
7246 isidx = procs_candidates[dest];
7247 } else {
7248 isidx = dest;
7249 }
7250 } else {
7251 issize = 0;
7252 isidx = -1;
7253 }
7254 if (*n_subdomains != 1) *n_subdomains = active_procs;
7255 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),7255,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7256 ierr = PetscFree(procs_candidates)((*PetscTrFree)((void*)(procs_candidates),7256,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((procs_candidates) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7256,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7257 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7258 }
7259 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),7259,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7260 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),7260,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7261 threshold = PetscMax(threshold,2)(((threshold)<(2)) ? (2) : (threshold));
7262
7263 /* Get info on mapping */
7264 ierr = ISLocalToGlobalMappingGetInfo(mat->rmap->mapping,&n_neighs,&neighs,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7264,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7265
7266 /* build local CSR graph of subdomains' connectivity */
7267 ierr = PetscMalloc1(2,&xadj)PetscMallocA(1,PETSC_FALSE,7267,__func__,"/sandbox/petsc/petsc.master/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),7267,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7268 xadj[0] = 0;
7269 xadj[1] = PetscMax(n_neighs-1,0)(((n_neighs-1)<(0)) ? (0) : (n_neighs-1));
7270 ierr = PetscMalloc1(xadj[1],&adjncy)PetscMallocA(1,PETSC_FALSE,7270,__func__,"/sandbox/petsc/petsc.master/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),7270,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7271 ierr = PetscMalloc1(xadj[1],&adjncy_wgt)PetscMallocA(1,PETSC_FALSE,7271,__func__,"/sandbox/petsc/petsc.master/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),7271,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7272 ierr = PetscCalloc1(n,&count)PetscMallocA(1,PETSC_TRUE,7272,__func__,"/sandbox/petsc/petsc.master/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),7272,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7273 for (i=1;i<n_neighs;i++)
7274 for (j=0;j<n_shared[i];j++)
7275 count[shared[i][j]] += 1;
7276
7277 xadj_count = 0;
7278 for (i=1;i<n_neighs;i++) {
7279 for (j=0;j<n_shared[i];j++) {
7280 if (count[shared[i][j]] < threshold) {
7281 adjncy[xadj_count] = neighs[i];
7282 adjncy_wgt[xadj_count] = n_shared[i];
7283 xadj_count++;
7284 break;
7285 }
7286 }
7287 }
7288 xadj[1] = xadj_count;
7289 ierr = PetscFree(count)((*PetscTrFree)((void*)(count),7289,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((count) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7289,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7290 ierr = ISLocalToGlobalMappingRestoreInfo(mat->rmap->mapping,&n_neighs,&neighs,&n_shared,&shared);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7290,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7291 ierr = PetscSortIntWithArray(xadj[1],adjncy,adjncy_wgt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7291,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7292
7293 ierr = PetscMalloc1(1,&ranks_send_to_idx)PetscMallocA(1,PETSC_FALSE,7293,__func__,"/sandbox/petsc/petsc.master/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),7293,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7294
7295 /* Restrict work on active processes only */
7296 ierr = PetscMPIIntCast(im_active,&color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7296,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7297 if (void_procs) {
7298 ierr = PetscSubcommCreate(PetscObjectComm((PetscObject)mat),&psubcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7298,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7299 ierr = PetscSubcommSetNumber(psubcomm,2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7299,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* 2 groups, active process and not active processes */
7300 ierr = PetscSubcommSetTypeGeneral(psubcomm,color,rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7300,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7301 subcomm = PetscSubcommChild(psubcomm);
7302 } else {
7303 psubcomm = NULL((void*)0);
7304 subcomm = PetscObjectComm((PetscObject)mat);
7305 }
7306
7307 v_wgt = NULL((void*)0);
7308 if (!color) {
7309 ierr = PetscFree(xadj)((*PetscTrFree)((void*)(xadj),7309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((xadj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7310 ierr = PetscFree(adjncy)((*PetscTrFree)((void*)(adjncy),7310,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7310,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7311 ierr = PetscFree(adjncy_wgt)((*PetscTrFree)((void*)(adjncy_wgt),7311,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy_wgt) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7311,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7312 } else {
7313 Mat subdomain_adj;
7314 IS new_ranks,new_ranks_contig;
7315 MatPartitioning partitioner;
7316 PetscInt rstart=0,rend=0;
7317 PetscInt *is_indices,*oldranks;
7318 PetscMPIInt size;
7319 PetscBool aggregate;
7320
7321 ierr = MPI_Comm_size(subcomm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7321,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7322 if (void_procs) {
7323 PetscInt prank = rank;
7324 ierr = PetscMalloc1(size,&oldranks)PetscMallocA(1,PETSC_FALSE,7324,__func__,"/sandbox/petsc/petsc.master/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),7324,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7325 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),7325,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7326 for (i=0;i<xadj[1];i++) {
7327 ierr = PetscFindInt(adjncy[i],size,oldranks,&adjncy[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7327,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7328 }
7329 ierr = PetscSortIntWithArray(xadj[1],adjncy,adjncy_wgt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7329,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7330 } else {
7331 oldranks = NULL((void*)0);
7332 }
7333 aggregate = ((redprocs > 0 && redprocs < size) ? PETSC_TRUE : PETSC_FALSE);
7334 if (aggregate) { /* TODO: all this part could be made more efficient */
7335 PetscInt lrows,row,ncols,*cols;
7336 PetscMPIInt nrank;
7337 PetscScalar *vals;
7338
7339 ierr = MPI_Comm_rank(subcomm,&nrank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7339,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7340 lrows = 0;
7341 if (nrank<redprocs) {
7342 lrows = size/redprocs;
7343 if (nrank<size%redprocs) lrows++;
7344 }
7345 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),7345,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7346 ierr = MatGetOwnershipRange(subdomain_adj,&rstart,&rend);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7346,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7347 ierr = MatSetOption(subdomain_adj,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7347,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7348 ierr = MatSetOption(subdomain_adj,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7348,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7349 row = nrank;
7350 ncols = xadj[1]-xadj[0];
7351 cols = adjncy;
7352 ierr = PetscMalloc1(ncols,&vals)PetscMallocA(1,PETSC_FALSE,7352,__func__,"/sandbox/petsc/petsc.master/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),7352,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7353 for (i=0;i<ncols;i++) vals[i] = adjncy_wgt[i];
7354 ierr = MatSetValues(subdomain_adj,1,&row,ncols,cols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7354,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7355 ierr = MatAssemblyBegin(subdomain_adj,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7355,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7356 ierr = MatAssemblyEnd(subdomain_adj,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7356,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7357 ierr = PetscFree(xadj)((*PetscTrFree)((void*)(xadj),7357,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((xadj) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7357,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7358 ierr = PetscFree(adjncy)((*PetscTrFree)((void*)(adjncy),7358,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7358,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7359 ierr = PetscFree(adjncy_wgt)((*PetscTrFree)((void*)(adjncy_wgt),7359,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((adjncy_wgt) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7359,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7360 ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),7360,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7360,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7361 if (use_vwgt) {
7362 Vec v;
7363 const PetscScalar *array;
7364 PetscInt nl;
7365
7366 ierr = MatCreateVecs(subdomain_adj,&v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7366,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7367 ierr = VecSetValue(v,row,(PetscScalar)n,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7367,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7368 ierr = VecAssemblyBegin(v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7368,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7369 ierr = VecAssemblyEnd(v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7369,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7370 ierr = VecGetLocalSize(v,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7370,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7371 ierr = VecGetArrayRead(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7371,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7372 ierr = PetscMalloc1(nl,&v_wgt)PetscMallocA(1,PETSC_FALSE,7372,__func__,"/sandbox/petsc/petsc.master/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),7372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7373 for (i=0;i<nl;i++) v_wgt[i] = (PetscInt)PetscRealPart(array[i])(array[i]);
7374 ierr = VecRestoreArrayRead(v,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7374,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7375 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7375,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7376 }
7377 } else {
7378 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),7378,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7379 if (use_vwgt) {
7380 ierr = PetscMalloc1(1,&v_wgt)PetscMallocA(1,PETSC_FALSE,7380,__func__,"/sandbox/petsc/petsc.master/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),7380,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7381 v_wgt[0] = n;
7382 }
7383 }
7384 /* ierr = MatView(subdomain_adj,0);CHKERRQ(ierr); */
7385
7386 /* Partition */
7387 ierr = MatPartitioningCreate(subcomm,&partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7387,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7388#if defined(PETSC_HAVE_PTSCOTCH1)
7389 ierr = MatPartitioningSetType(partitioner,MATPARTITIONINGPTSCOTCH"ptscotch");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7389,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7390#elif defined(PETSC_HAVE_PARMETIS1)
7391 ierr = MatPartitioningSetType(partitioner,MATPARTITIONINGPARMETIS"parmetis");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7391,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7392#else
7393 ierr = MatPartitioningSetType(partitioner,MATPARTITIONINGAVERAGE"average");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7393,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7394#endif
7395 ierr = MatPartitioningSetAdjacency(partitioner,subdomain_adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7395,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7396 if (v_wgt) {
7397 ierr = MatPartitioningSetVertexWeights(partitioner,v_wgt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7397,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7398 }
7399 *n_subdomains = PetscMin((PetscInt)size,*n_subdomains)((((PetscInt)size)<(*n_subdomains)) ? ((PetscInt)size) : (
*n_subdomains))
;
7400 ierr = MatPartitioningSetNParts(partitioner,*n_subdomains);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7400,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7401 ierr = MatPartitioningSetFromOptions(partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7401,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7402 ierr = MatPartitioningApply(partitioner,&new_ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7402,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7403 /* ierr = MatPartitioningView(partitioner,0);CHKERRQ(ierr); */
7404
7405 /* renumber new_ranks to avoid "holes" in new set of processors */
7406 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),7406,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7407 ierr = ISDestroy(&new_ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7407,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7408 ierr = ISGetIndices(new_ranks_contig,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7408,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7409 if (!aggregate) {
7410 if (procs_candidates) { /* shift the pattern on non-active candidates (if any) */
7411#if defined(PETSC_USE_DEBUG1)
7412 if (!oldranks) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"This should not happen")return PetscError(((MPI_Comm)0x44000001),7412,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
7413#endif
7414 ranks_send_to_idx[0] = procs_candidates[oldranks[is_indices[0]]];
7415 } else if (oldranks) {
7416 ranks_send_to_idx[0] = oldranks[is_indices[0]];
7417 } else {
7418 ranks_send_to_idx[0] = is_indices[0];
7419 }
7420 } else {
7421 PetscInt idx = 0;
7422 PetscMPIInt tag;
7423 MPI_Request *reqs;
7424
7425 ierr = PetscObjectGetNewTag((PetscObject)subdomain_adj,&tag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7425,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7426 ierr = PetscMalloc1(rend-rstart,&reqs)PetscMallocA(1,PETSC_FALSE,7426,__func__,"/sandbox/petsc/petsc.master/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),7426,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7427 for (i=rstart;i<rend;i++) {
7428 ierr = MPI_Isend(is_indices+i-rstart,1,MPIU_INT,i,tag,subcomm,&reqs[i-rstart])((petsc_isend_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype
)0x4c000405)),&(petsc_isend_len)) || 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),7428,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7429 }
7430 ierr = MPI_Recv(&idx,1,MPIU_INT,MPI_ANY_SOURCE,tag,subcomm,MPI_STATUS_IGNORE)((petsc_recv_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype)
0x4c000405)),(&petsc_recv_len)) || 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),7430,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7431 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),7431,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7432 ierr = PetscFree(reqs)((*PetscTrFree)((void*)(reqs),7432,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((reqs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7432,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7433 if (procs_candidates) { /* shift the pattern on non-active candidates (if any) */
7434#if defined(PETSC_USE_DEBUG1)
7435 if (!oldranks) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"This should not happen")return PetscError(((MPI_Comm)0x44000001),7435,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
7436#endif
7437 ranks_send_to_idx[0] = procs_candidates[oldranks[idx]];
7438 } else if (oldranks) {
7439 ranks_send_to_idx[0] = oldranks[idx];
7440 } else {
7441 ranks_send_to_idx[0] = idx;
7442 }
7443 }
7444 ierr = ISRestoreIndices(new_ranks_contig,(const PetscInt**)&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7444,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7445 /* clean up */
7446 ierr = PetscFree(oldranks)((*PetscTrFree)((void*)(oldranks),7446,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((oldranks) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7446,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7447 ierr = ISDestroy(&new_ranks_contig);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7447,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7448 ierr = MatDestroy(&subdomain_adj);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7448,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7449 ierr = MatPartitioningDestroy(&partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7449,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7450 }
7451 ierr = PetscSubcommDestroy(&psubcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7451,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7452 ierr = PetscFree(procs_candidates)((*PetscTrFree)((void*)(procs_candidates),7452,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((procs_candidates) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7452,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7453
7454 /* assemble parallel IS for sends */
7455 i = 1;
7456 if (!color) i=0;
7457 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),7457,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7458 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7459}
7460
7461typedef enum {MATDENSE_PRIVATE=0,MATAIJ_PRIVATE,MATBAIJ_PRIVATE,MATSBAIJ_PRIVATE}MatTypePrivate;
7462
7463PetscErrorCode 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[])
7464{
7465 Mat local_mat;
7466 IS is_sends_internal;
7467 PetscInt rows,cols,new_local_rows;
7468 PetscInt i,bs,buf_size_idxs,buf_size_idxs_is,buf_size_vals,buf_size_vecs;
7469 PetscBool ismatis,isdense,newisdense,destroy_mat;
7470 ISLocalToGlobalMapping l2gmap;
7471 PetscInt* l2gmap_indices;
7472 const PetscInt* is_indices;
7473 MatType new_local_type;
7474 /* buffers */
7475 PetscInt *ptr_idxs,*send_buffer_idxs,*recv_buffer_idxs;
7476 PetscInt *ptr_idxs_is,*send_buffer_idxs_is,*recv_buffer_idxs_is;
7477 PetscInt *recv_buffer_idxs_local;
7478 PetscScalar *ptr_vals,*recv_buffer_vals;
7479 const PetscScalar *send_buffer_vals;
7480 PetscScalar *ptr_vecs,*send_buffer_vecs,*recv_buffer_vecs;
7481 /* MPI */
7482 MPI_Comm comm,comm_n;
7483 PetscSubcomm subcomm;
7484 PetscMPIInt n_sends,n_recvs,size;
7485 PetscMPIInt *iflags,*ilengths_idxs,*ilengths_vals,*ilengths_idxs_is;
7486 PetscMPIInt *onodes,*onodes_is,*olengths_idxs,*olengths_idxs_is,*olengths_vals;
7487 PetscMPIInt len,tag_idxs,tag_idxs_is,tag_vals,tag_vecs,source_dest;
7488 MPI_Request *send_req_idxs,*send_req_idxs_is,*send_req_vals,*send_req_vecs;
7489 MPI_Request *recv_req_idxs,*recv_req_idxs_is,*recv_req_vals,*recv_req_vecs;
7490 PetscErrorCode ierr;
7491
7492 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 7492; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7493 PetscValidHeaderSpecific(mat,MAT_CLASSID,1)do { if (!mat) return PetscError(((MPI_Comm)0x44000001),7493,
__func__,"/sandbox/petsc/petsc.master/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),7493,__func__,"/sandbox/petsc/petsc.master/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),7493,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7493,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
7494 ierr = PetscObjectTypeCompare((PetscObject)mat,MATIS"is",&ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7494,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7495 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),7495,__func__
,"/sandbox/petsc/petsc.master/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__)
;
7496 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,7496,__func__,"/sandbox/petsc/petsc.master/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.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,3); } while (0)
;
7497 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,7497,__func__,"/sandbox/petsc/petsc.master/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.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,4); } while (0)
;
7498 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,7498,__func__,"/sandbox/petsc/petsc.master/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),7498,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7498
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,5); } while (0)
;
7499 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,7499,__func__,"/sandbox/petsc/petsc.master/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),7499,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7499
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d"
,6); } while (0)
;
7500 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,7500,__func__,"/sandbox/petsc/petsc.master/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),7500,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7500
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,8); } while (0)
;
7501 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,7501,__func__,"/sandbox/petsc/petsc.master/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),7501,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7501
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,10); } while (0)
;
7502 if (nvecs) {
7503 if (nvecs > 1) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Just 1 vector supported")return PetscError(PetscObjectComm((PetscObject)mat),7503,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Just 1 vector supported")
;
7504 PetscValidHeaderSpecific(nnsp_vec[0],VEC_CLASSID,11)do { if (!nnsp_vec[0]) return PetscError(((MPI_Comm)0x44000001
),7504,__func__,"/sandbox/petsc/petsc.master/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),7504,__func__,"/sandbox/petsc/petsc.master/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),7504,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,11); else return PetscError(((MPI_Comm)0x44000001),7504,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,11); } } while (0)
;
7505 }
7506 /* further checks */
7507 ierr = MatISGetLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7507,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7508 ierr = PetscObjectTypeCompare((PetscObject)local_mat,MATSEQDENSE"seqdense",&isdense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7508,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7509 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),7509,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Currently cannot subassemble MATIS when local matrix type is not of type SEQDENSE"
)
;
7510 ierr = MatGetSize(local_mat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7510,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7511 if (rows != cols) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Local MATIS matrices should be square")return PetscError(PetscObjectComm((PetscObject)mat),7511,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Local MATIS matrices should be square"
)
;
7512 if (reuse && *mat_n) {
7513 PetscInt mrows,mcols,mnrows,mncols;
7514 PetscValidHeaderSpecific(*mat_n,MAT_CLASSID,7)do { if (!*mat_n) return PetscError(((MPI_Comm)0x44000001),7514
,__func__,"/sandbox/petsc/petsc.master/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),7514,__func__,"/sandbox/petsc/petsc.master/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),7514,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,7); else return PetscError(((MPI_Comm)0x44000001),7514,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,7); } } while (0)
;
7515 ierr = PetscObjectTypeCompare((PetscObject)*mat_n,MATIS"is",&ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7515,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7516 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),7516,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot reuse a matrix which is not of type MATIS"
)
;
7517 ierr = MatGetSize(mat,&mrows,&mcols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7517,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7518 ierr = MatGetSize(*mat_n,&mnrows,&mncols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7518,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7519 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),7519,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot reuse matrix! Wrong number of rows %D != %D"
,mrows,mnrows)
;
7520 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),7520,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot reuse matrix! Wrong number of cols %D != %D"
,mcols,mncols)
;
7521 }
7522 ierr = MatGetBlockSize(local_mat,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7522,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7523 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,7523,__func__,"/sandbox/petsc/petsc.master/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),7523,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)mat),7523
,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,0); } while (0)
;
7524
7525 /* prepare IS for sending if not provided */
7526 if (!is_sends) {
7527 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),7527,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"You should specify either an IS or a target number of subdomains"
)
;
7528 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),7528,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7529 } else {
7530 ierr = PetscObjectReference((PetscObject)is_sends);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7530,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7531 is_sends_internal = is_sends;
7532 }
7533
7534 /* get comm */
7535 ierr = PetscObjectGetComm((PetscObject)mat,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7535,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7536
7537 /* compute number of sends */
7538 ierr = ISGetLocalSize(is_sends_internal,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7538,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7539 ierr = PetscMPIIntCast(i,&n_sends);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7539,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7540
7541 /* compute number of receives */
7542 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7542,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7543 ierr = PetscMalloc1(size,&iflags)PetscMallocA(1,PETSC_FALSE,7543,__func__,"/sandbox/petsc/petsc.master/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),7543,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7544 ierr = PetscArrayzero(iflags,size)PetscMemzero(iflags,(size)*sizeof(*(iflags)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7544,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7545 ierr = ISGetIndices(is_sends_internal,&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7545,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7546 for (i=0;i<n_sends;i++) iflags[is_indices[i]] = 1;
7547 ierr = PetscGatherNumberOfMessages(comm,iflags,NULL((void*)0),&n_recvs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7547,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7548 ierr = PetscFree(iflags)((*PetscTrFree)((void*)(iflags),7548,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((iflags) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7548,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7549
7550 /* restrict comm if requested */
7551 subcomm = 0;
7552 destroy_mat = PETSC_FALSE;
7553 if (restrict_comm) {
7554 PetscMPIInt color,subcommsize;
7555
7556 color = 0;
7557 if (restrict_full) {
7558 if (!n_recvs) color = 1; /* processes not receiving anything will not partecipate in new comm (full restriction) */
7559 } else {
7560 if (!n_recvs && n_sends) color = 1; /* just those processes that are sending but not receiving anything will not partecipate in new comm */
7561 }
7562 ierr = MPIU_Allreduce(&color,&subcommsize,1,MPI_INT,MPI_SUM,comm)(PetscAllreduceBarrierCheck(comm,1,7562,__func__,"/sandbox/petsc/petsc.master/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),7562,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7563 subcommsize = size - subcommsize;
7564 /* check if reuse has been requested */
7565 if (reuse) {
7566 if (*mat_n) {
7567 PetscMPIInt subcommsize2;
7568 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)*mat_n),&subcommsize2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7568,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7569 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),7569,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Cannot reuse matrix! wrong subcomm size %d != %d"
,subcommsize,subcommsize2)
;
7570 comm_n = PetscObjectComm((PetscObject)*mat_n);
7571 } else {
7572 comm_n = PETSC_COMM_SELF((MPI_Comm)0x44000001);
7573 }
7574 } else { /* MAT_INITIAL_MATRIX */
7575 PetscMPIInt rank;
7576
7577 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7577,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7578 ierr = PetscSubcommCreate(comm,&subcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7578,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7579 ierr = PetscSubcommSetNumber(subcomm,2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7579,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7580 ierr = PetscSubcommSetTypeGeneral(subcomm,color,rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7580,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7581 comm_n = PetscSubcommChild(subcomm);
7582 }
7583 /* flag to destroy *mat_n if not significative */
7584 if (color) destroy_mat = PETSC_TRUE;
7585 } else {
7586 comm_n = comm;
7587 }
7588
7589 /* prepare send/receive buffers */
7590 ierr = PetscMalloc1(size,&ilengths_idxs)PetscMallocA(1,PETSC_FALSE,7590,__func__,"/sandbox/petsc/petsc.master/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),7590,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7591 ierr = PetscArrayzero(ilengths_idxs,size)PetscMemzero(ilengths_idxs,(size)*sizeof(*(ilengths_idxs)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7591,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7592 ierr = PetscMalloc1(size,&ilengths_vals)PetscMallocA(1,PETSC_FALSE,7592,__func__,"/sandbox/petsc/petsc.master/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),7592,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7593 ierr = PetscArrayzero(ilengths_vals,size)PetscMemzero(ilengths_vals,(size)*sizeof(*(ilengths_vals)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7593,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7594 if (nis) {
7595 ierr = PetscCalloc1(size,&ilengths_idxs_is)PetscMallocA(1,PETSC_TRUE,7595,__func__,"/sandbox/petsc/petsc.master/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),7595,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7596 }
7597
7598 /* Get data from local matrices */
7599 if (!isdense) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"Subassembling of AIJ local matrices not yet implemented")return PetscError(PetscObjectComm((PetscObject)mat),7599,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Subassembling of AIJ local matrices not yet implemented"
)
;
7600 /* TODO: See below some guidelines on how to prepare the local buffers */
7601 /*
7602 send_buffer_vals should contain the raw values of the local matrix
7603 send_buffer_idxs should contain:
7604 - MatType_PRIVATE type
7605 - PetscInt size_of_l2gmap
7606 - PetscInt global_row_indices[size_of_l2gmap]
7607 - PetscInt all_other_info_which_is_needed_to_compute_preallocation_and_set_values
7608 */
7609 else {
7610 ierr = MatDenseGetArrayRead(local_mat,&send_buffer_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7610,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7611 ierr = ISLocalToGlobalMappingGetSize(mat->rmap->mapping,&i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7611,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7612 ierr = PetscMalloc1(i+2,&send_buffer_idxs)PetscMallocA(1,PETSC_FALSE,7612,__func__,"/sandbox/petsc/petsc.master/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),7612,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7613 send_buffer_idxs[0] = (PetscInt)MATDENSE_PRIVATE;
7614 send_buffer_idxs[1] = i;
7615 ierr = ISLocalToGlobalMappingGetIndices(mat->rmap->mapping,(const PetscInt**)&ptr_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7615,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7616 ierr = PetscArraycpy(&send_buffer_idxs[2],ptr_idxs,i)((sizeof(*(&send_buffer_idxs[2])) != sizeof(*(ptr_idxs)))
|| PetscMemcpy(&send_buffer_idxs[2],ptr_idxs,(i)*sizeof(
*(&send_buffer_idxs[2]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7616,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7617 ierr = ISLocalToGlobalMappingRestoreIndices(mat->rmap->mapping,(const PetscInt**)&ptr_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7617,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7618 ierr = PetscMPIIntCast(i,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7618,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7619 for (i=0;i<n_sends;i++) {
7620 ilengths_vals[is_indices[i]] = len*len;
7621 ilengths_idxs[is_indices[i]] = len+2;
7622 }
7623 }
7624 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),7624,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7625 /* additional is (if any) */
7626 if (nis) {
7627 PetscMPIInt psum;
7628 PetscInt j;
7629 for (j=0,psum=0;j<nis;j++) {
7630 PetscInt plen;
7631 ierr = ISGetLocalSize(isarray[j],&plen);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7631,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7632 ierr = PetscMPIIntCast(plen,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7632,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7633 psum += len+1; /* indices + lenght */
7634 }
7635 ierr = PetscMalloc1(psum,&send_buffer_idxs_is)PetscMallocA(1,PETSC_FALSE,7635,__func__,"/sandbox/petsc/petsc.master/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),7635,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7636 for (j=0,psum=0;j<nis;j++) {
7637 PetscInt plen;
7638 const PetscInt *is_array_idxs;
7639 ierr = ISGetLocalSize(isarray[j],&plen);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7639,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7640 send_buffer_idxs_is[psum] = plen;
7641 ierr = ISGetIndices(isarray[j],&is_array_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7641,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7642 ierr = PetscArraycpy(&send_buffer_idxs_is[psum+1],is_array_idxs,plen)((sizeof(*(&send_buffer_idxs_is[psum+1])) != sizeof(*(is_array_idxs
))) || PetscMemcpy(&send_buffer_idxs_is[psum+1],is_array_idxs
,(plen)*sizeof(*(&send_buffer_idxs_is[psum+1]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7642,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7643 ierr = ISRestoreIndices(isarray[j],&is_array_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7643,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7644 psum += plen+1; /* indices + lenght */
7645 }
7646 for (i=0;i<n_sends;i++) {
7647 ilengths_idxs_is[is_indices[i]] = psum;
7648 }
7649 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),7649,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7650 }
7651 ierr = MatISRestoreLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7651,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7652
7653 buf_size_idxs = 0;
7654 buf_size_vals = 0;
7655 buf_size_idxs_is = 0;
7656 buf_size_vecs = 0;
7657 for (i=0;i<n_recvs;i++) {
7658 buf_size_idxs += (PetscInt)olengths_idxs[i];
7659 buf_size_vals += (PetscInt)olengths_vals[i];
7660 if (nis) buf_size_idxs_is += (PetscInt)olengths_idxs_is[i];
7661 if (nvecs) buf_size_vecs += (PetscInt)olengths_idxs[i];
7662 }
7663 ierr = PetscMalloc1(buf_size_idxs,&recv_buffer_idxs)PetscMallocA(1,PETSC_FALSE,7663,__func__,"/sandbox/petsc/petsc.master/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),7663,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7664 ierr = PetscMalloc1(buf_size_vals,&recv_buffer_vals)PetscMallocA(1,PETSC_FALSE,7664,__func__,"/sandbox/petsc/petsc.master/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),7664,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7665 ierr = PetscMalloc1(buf_size_idxs_is,&recv_buffer_idxs_is)PetscMallocA(1,PETSC_FALSE,7665,__func__,"/sandbox/petsc/petsc.master/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),7665,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7666 ierr = PetscMalloc1(buf_size_vecs,&recv_buffer_vecs)PetscMallocA(1,PETSC_FALSE,7666,__func__,"/sandbox/petsc/petsc.master/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),7666,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7667
7668 /* get new tags for clean communications */
7669 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7669,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7670 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7670,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7671 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_idxs_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7671,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7672 ierr = PetscObjectGetNewTag((PetscObject)mat,&tag_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7672,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7673
7674 /* allocate for requests */
7675 ierr = PetscMalloc1(n_sends,&send_req_idxs)PetscMallocA(1,PETSC_FALSE,7675,__func__,"/sandbox/petsc/petsc.master/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),7675,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7676 ierr = PetscMalloc1(n_sends,&send_req_vals)PetscMallocA(1,PETSC_FALSE,7676,__func__,"/sandbox/petsc/petsc.master/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),7676,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7677 ierr = PetscMalloc1(n_sends,&send_req_idxs_is)PetscMallocA(1,PETSC_FALSE,7677,__func__,"/sandbox/petsc/petsc.master/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),7677,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7678 ierr = PetscMalloc1(n_sends,&send_req_vecs)PetscMallocA(1,PETSC_FALSE,7678,__func__,"/sandbox/petsc/petsc.master/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),7678,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7679 ierr = PetscMalloc1(n_recvs,&recv_req_idxs)PetscMallocA(1,PETSC_FALSE,7679,__func__,"/sandbox/petsc/petsc.master/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),7679,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7680 ierr = PetscMalloc1(n_recvs,&recv_req_vals)PetscMallocA(1,PETSC_FALSE,7680,__func__,"/sandbox/petsc/petsc.master/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),7680,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7681 ierr = PetscMalloc1(n_recvs,&recv_req_idxs_is)PetscMallocA(1,PETSC_FALSE,7681,__func__,"/sandbox/petsc/petsc.master/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),7681,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7682 ierr = PetscMalloc1(n_recvs,&recv_req_vecs)PetscMallocA(1,PETSC_FALSE,7682,__func__,"/sandbox/petsc/petsc.master/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),7682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7683
7684 /* communications */
7685 ptr_idxs = recv_buffer_idxs;
7686 ptr_vals = recv_buffer_vals;
7687 ptr_idxs_is = recv_buffer_idxs_is;
7688 ptr_vecs = recv_buffer_vecs;
7689 for (i=0;i<n_recvs;i++) {
7690 source_dest = onodes[i];
7691 ierr = MPI_Irecv(ptr_idxs,olengths_idxs[i],MPIU_INT,source_dest,tag_idxs,comm,&recv_req_idxs[i])((petsc_irecv_ct++,0) || PetscMPITypeSize((olengths_idxs[i]),
(((MPI_Datatype)0x4c000405)),&(petsc_irecv_len)) || 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),7691,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7692 ierr = MPI_Irecv(ptr_vals,olengths_vals[i],MPIU_SCALAR,source_dest,tag_vals,comm,&recv_req_vals[i])((petsc_irecv_ct++,0) || PetscMPITypeSize((olengths_vals[i]),
(((MPI_Datatype)0x4c00080b)),&(petsc_irecv_len)) || 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),7692,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7693 ptr_idxs += olengths_idxs[i];
7694 ptr_vals += olengths_vals[i];
7695 if (nis) {
7696 source_dest = onodes_is[i];
7697 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((olengths_idxs_is[i
]),(((MPI_Datatype)0x4c000405)),&(petsc_irecv_len)) || 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),7697,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7698 ptr_idxs_is += olengths_idxs_is[i];
7699 }
7700 if (nvecs) {
7701 source_dest = onodes[i];
7702 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((olengths_idxs[i]-2
),(((MPI_Datatype)0x4c00080b)),&(petsc_irecv_len)) || 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),7702,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7703 ptr_vecs += olengths_idxs[i]-2;
7704 }
7705 }
7706 for (i=0;i<n_sends;i++) {
7707 ierr = PetscMPIIntCast(is_indices[i],&source_dest);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7707,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7708 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((ilengths_idxs[source_dest
]),(((MPI_Datatype)0x4c000405)),&(petsc_isend_len)) || 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),7708,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7709 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((ilengths_vals[source_dest
]),(((MPI_Datatype)0x4c00080b)),&(petsc_isend_len)) || 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),7709,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7710 if (nis) {
7711 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((ilengths_idxs_is[source_dest
]),(((MPI_Datatype)0x4c000405)),&(petsc_isend_len)) || 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),7711,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7712 }
7713 if (nvecs) {
7714 ierr = VecGetArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7714,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7715 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((ilengths_idxs[source_dest
]-2),(((MPI_Datatype)0x4c00080b)),&(petsc_isend_len)) || 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),7715,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7716 }
7717 }
7718 ierr = ISRestoreIndices(is_sends_internal,&is_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7718,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7719 ierr = ISDestroy(&is_sends_internal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7719,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7720
7721 /* assemble new l2g map */
7722 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),7722,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7723 ptr_idxs = recv_buffer_idxs;
7724 new_local_rows = 0;
7725 for (i=0;i<n_recvs;i++) {
7726 new_local_rows += *(ptr_idxs+1); /* second element is the local size of the l2gmap */
7727 ptr_idxs += olengths_idxs[i];
7728 }
7729 ierr = PetscMalloc1(new_local_rows,&l2gmap_indices)PetscMallocA(1,PETSC_FALSE,7729,__func__,"/sandbox/petsc/petsc.master/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),7729,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7730 ptr_idxs = recv_buffer_idxs;
7731 new_local_rows = 0;
7732 for (i=0;i<n_recvs;i++) {
7733 ierr = PetscArraycpy(&l2gmap_indices[new_local_rows],ptr_idxs+2,*(ptr_idxs+1))((sizeof(*(&l2gmap_indices[new_local_rows])) != sizeof(*(
ptr_idxs+2))) || PetscMemcpy(&l2gmap_indices[new_local_rows
],ptr_idxs+2,(*(ptr_idxs+1))*sizeof(*(&l2gmap_indices[new_local_rows
]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7733,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7734 new_local_rows += *(ptr_idxs+1); /* second element is the local size of the l2gmap */
7735 ptr_idxs += olengths_idxs[i];
7736 }
7737 ierr = PetscSortRemoveDupsInt(&new_local_rows,l2gmap_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7737,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7738 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),7738,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7739 ierr = PetscFree(l2gmap_indices)((*PetscTrFree)((void*)(l2gmap_indices),7739,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((l2gmap_indices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7739,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7740
7741 /* infer new local matrix type from received local matrices type */
7742 /* currently if all local matrices are of type X, then the resulting matrix will be of type X, except for the dense case */
7743 /* 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) */
7744 if (n_recvs) {
7745 MatTypePrivate new_local_type_private = (MatTypePrivate)send_buffer_idxs[0];
7746 ptr_idxs = recv_buffer_idxs;
7747 for (i=0;i<n_recvs;i++) {
7748 if ((PetscInt)new_local_type_private != *ptr_idxs) {
7749 new_local_type_private = MATAIJ_PRIVATE;
7750 break;
7751 }
7752 ptr_idxs += olengths_idxs[i];
7753 }
7754 switch (new_local_type_private) {
7755 case MATDENSE_PRIVATE:
7756 new_local_type = MATSEQAIJ"seqaij";
7757 bs = 1;
7758 break;
7759 case MATAIJ_PRIVATE:
7760 new_local_type = MATSEQAIJ"seqaij";
7761 bs = 1;
7762 break;
7763 case MATBAIJ_PRIVATE:
7764 new_local_type = MATSEQBAIJ"seqbaij";
7765 break;
7766 case MATSBAIJ_PRIVATE:
7767 new_local_type = MATSEQSBAIJ"seqsbaij";
7768 break;
7769 default:
7770 SETERRQ2(comm,PETSC_ERR_SUP,"Unsupported private type %d in %s",new_local_type_private,PETSC_FUNCTION_NAME)return PetscError(comm,7770,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Unsupported private type %d in %s",new_local_type_private
,__func__)
;
7771 break;
7772 }
7773 } else { /* by default, new_local_type is seqaij */
7774 new_local_type = MATSEQAIJ"seqaij";
7775 bs = 1;
7776 }
7777
7778 /* create MATIS object if needed */
7779 if (!reuse) {
7780 ierr = MatGetSize(mat,&rows,&cols);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7780,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7781 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),7781,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7782 } else {
7783 /* it also destroys the local matrices */
7784 if (*mat_n) {
7785 ierr = MatSetLocalToGlobalMapping(*mat_n,l2gmap,l2gmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7785,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7786 } else { /* this is a fake object */
7787 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),7787,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7788 }
7789 }
7790 ierr = MatISGetLocalMat(*mat_n,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7790,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7791 ierr = MatSetType(local_mat,new_local_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7791,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7792
7793 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),7793,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7794
7795 /* Global to local map of received indices */
7796 ierr = PetscMalloc1(buf_size_idxs,&recv_buffer_idxs_local)PetscMallocA(1,PETSC_FALSE,7796,__func__,"/sandbox/petsc/petsc.master/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),7796,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* needed for values insertion */
7797 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),7797,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7798 ierr = ISLocalToGlobalMappingDestroy(&l2gmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7798,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7799
7800 /* restore attributes -> type of incoming data and its size */
7801 buf_size_idxs = 0;
7802 for (i=0;i<n_recvs;i++) {
7803 recv_buffer_idxs_local[buf_size_idxs] = recv_buffer_idxs[buf_size_idxs];
7804 recv_buffer_idxs_local[buf_size_idxs+1] = recv_buffer_idxs[buf_size_idxs+1];
7805 buf_size_idxs += (PetscInt)olengths_idxs[i];
7806 }
7807 ierr = PetscFree(recv_buffer_idxs)((*PetscTrFree)((void*)(recv_buffer_idxs),7807,__func__,"/sandbox/petsc/petsc.master/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),7807,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7808
7809 /* set preallocation */
7810 ierr = PetscObjectTypeCompare((PetscObject)local_mat,MATSEQDENSE"seqdense",&newisdense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7810,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7811 if (!newisdense) {
7812 PetscInt *new_local_nnz=0;
7813
7814 ptr_idxs = recv_buffer_idxs_local;
7815 if (n_recvs) {
7816 ierr = PetscCalloc1(new_local_rows,&new_local_nnz)PetscMallocA(1,PETSC_TRUE,7816,__func__,"/sandbox/petsc/petsc.master/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),7816,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7817 }
7818 for (i=0;i<n_recvs;i++) {
7819 PetscInt j;
7820 if (*ptr_idxs == (PetscInt)MATDENSE_PRIVATE) { /* preallocation provided for dense case only */
7821 for (j=0;j<*(ptr_idxs+1);j++) {
7822 new_local_nnz[*(ptr_idxs+2+j)] += *(ptr_idxs+1);
7823 }
7824 } else {
7825 /* TODO */
7826 }
7827 ptr_idxs += olengths_idxs[i];
7828 }
7829 if (new_local_nnz) {
7830 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))
;
7831 ierr = MatSeqAIJSetPreallocation(local_mat,0,new_local_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7831,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7832 for (i=0;i<new_local_rows;i++) new_local_nnz[i] /= bs;
7833 ierr = MatSeqBAIJSetPreallocation(local_mat,bs,0,new_local_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7833,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7834 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));
7835 ierr = MatSeqSBAIJSetPreallocation(local_mat,bs,0,new_local_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7835,__func__,"/sandbox/petsc/petsc.master/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.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7838 }
7839 ierr = PetscFree(new_local_nnz)((*PetscTrFree)((void*)(new_local_nnz),7839,__func__,"/sandbox/petsc/petsc.master/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),7839,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7840 } else {
7841 ierr = MatSetUp(local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7841,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7842 }
7843
7844 /* set values */
7845 ptr_vals = recv_buffer_vals;
7846 ptr_idxs = recv_buffer_idxs_local;
7847 for (i=0;i<n_recvs;i++) {
7848 if (*ptr_idxs == (PetscInt)MATDENSE_PRIVATE) { /* values insertion provided for dense case only */
7849 ierr = MatSetOption(local_mat,MAT_ROW_ORIENTED,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7849,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7850 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),7850,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7851 ierr = MatAssemblyBegin(local_mat,MAT_FLUSH_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7851,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7852 ierr = MatAssemblyEnd(local_mat,MAT_FLUSH_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7852,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7853 ierr = MatSetOption(local_mat,MAT_ROW_ORIENTED,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7853,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7854 } else {
7855 /* TODO */
7856 }
7857 ptr_idxs += olengths_idxs[i];
7858 ptr_vals += olengths_vals[i];
7859 }
7860 ierr = MatAssemblyBegin(local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7860,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7861 ierr = MatAssemblyEnd(local_mat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7861,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7862 ierr = MatISRestoreLocalMat(*mat_n,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7862,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7863 ierr = MatAssemblyBegin(*mat_n,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7863,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7864 ierr = MatAssemblyEnd(*mat_n,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7864,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7865 ierr = PetscFree(recv_buffer_vals)((*PetscTrFree)((void*)(recv_buffer_vals),7865,__func__,"/sandbox/petsc/petsc.master/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),7865,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7866
7867#if 0
7868 if (!restrict_comm) { /* check */
7869 Vec lvec,rvec;
7870 PetscReal infty_error;
7871
7872 ierr = MatCreateVecs(mat,&rvec,&lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7872,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7873 ierr = VecSetRandom(rvec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7873,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7874 ierr = MatMult(mat,rvec,lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7874,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7875 ierr = VecScale(lvec,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7875,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7876 ierr = MatMultAdd(*mat_n,rvec,lvec,lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7876,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7877 ierr = VecNorm(lvec,NORM_INFINITY,&infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7877,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7878 ierr = PetscPrintf(PetscObjectComm((PetscObject)mat),"Infinity error subassembling %1.6e\n",infty_error);
7879 ierr = VecDestroy(&rvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7879,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7880 ierr = VecDestroy(&lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7880,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7881 }
7882#endif
7883
7884 /* assemble new additional is (if any) */
7885 if (nis) {
7886 PetscInt **temp_idxs,*count_is,j,psum;
7887
7888 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),7888,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7889 ierr = PetscCalloc1(nis,&count_is)PetscMallocA(1,PETSC_TRUE,7889,__func__,"/sandbox/petsc/petsc.master/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),7889,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7890 ptr_idxs = recv_buffer_idxs_is;
7891 psum = 0;
7892 for (i=0;i<n_recvs;i++) {
7893 for (j=0;j<nis;j++) {
7894 PetscInt plen = *(ptr_idxs); /* first element is the local size of IS's indices */
7895 count_is[j] += plen; /* increment counting of buffer for j-th IS */
7896 psum += plen;
7897 ptr_idxs += plen+1; /* shift pointer to received data */
7898 }
7899 }
7900 ierr = PetscMalloc1(nis,&temp_idxs)PetscMallocA(1,PETSC_FALSE,7900,__func__,"/sandbox/petsc/petsc.master/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),7900,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7901 ierr = PetscMalloc1(psum,&temp_idxs[0])PetscMallocA(1,PETSC_FALSE,7901,__func__,"/sandbox/petsc/petsc.master/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),7901,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7902 for (i=1;i<nis;i++) {
7903 temp_idxs[i] = temp_idxs[i-1]+count_is[i-1];
7904 }
7905 ierr = PetscArrayzero(count_is,nis)PetscMemzero(count_is,(nis)*sizeof(*(count_is)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7905,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7906 ptr_idxs = recv_buffer_idxs_is;
7907 for (i=0;i<n_recvs;i++) {
7908 for (j=0;j<nis;j++) {
7909 PetscInt plen = *(ptr_idxs); /* first element is the local size of IS's indices */
7910 ierr = PetscArraycpy(&temp_idxs[j][count_is[j]],ptr_idxs+1,plen)((sizeof(*(&temp_idxs[j][count_is[j]])) != sizeof(*(ptr_idxs
+1))) || PetscMemcpy(&temp_idxs[j][count_is[j]],ptr_idxs+
1,(plen)*sizeof(*(&temp_idxs[j][count_is[j]]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7910,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7911 count_is[j] += plen; /* increment starting point of buffer for j-th IS */
7912 ptr_idxs += plen+1; /* shift pointer to received data */
7913 }
7914 }
7915 for (i=0;i<nis;i++) {
7916 ierr = ISDestroy(&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7916,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7917 ierr = PetscSortRemoveDupsInt(&count_is[i],temp_idxs[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7917,__func__,"/sandbox/petsc/petsc.master/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),7917,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7918 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),7918,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7919 }
7920 ierr = PetscFree(count_is)((*PetscTrFree)((void*)(count_is),7920,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((count_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7920,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7921 ierr = PetscFree(temp_idxs[0])((*PetscTrFree)((void*)(temp_idxs[0]),7921,__func__,"/sandbox/petsc/petsc.master/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),7921,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7922 ierr = PetscFree(temp_idxs)((*PetscTrFree)((void*)(temp_idxs),7922,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((temp_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7922,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7923 }
7924 /* free workspace */
7925 ierr = PetscFree(recv_buffer_idxs_is)((*PetscTrFree)((void*)(recv_buffer_idxs_is),7925,__func__,"/sandbox/petsc/petsc.master/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),7925,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7926 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),7926,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7927 ierr = PetscFree(send_buffer_idxs)((*PetscTrFree)((void*)(send_buffer_idxs),7927,__func__,"/sandbox/petsc/petsc.master/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),7927,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7928 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),7928,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7929 if (isdense) {
7930 ierr = MatISGetLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7930,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7931 ierr = MatDenseRestoreArrayRead(local_mat,&send_buffer_vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7931,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7932 ierr = MatISRestoreLocalMat(mat,&local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7932,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7933 } else {
7934 /* ierr = PetscFree(send_buffer_vals);CHKERRQ(ierr); */
7935 }
7936 if (nis) {
7937 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),7937,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7938 ierr = PetscFree(send_buffer_idxs_is)((*PetscTrFree)((void*)(send_buffer_idxs_is),7938,__func__,"/sandbox/petsc/petsc.master/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),7938,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7939 }
7940
7941 if (nvecs) {
7942 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),7942,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7943 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),7943,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7944 ierr = VecRestoreArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7944,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7945 ierr = VecDestroy(&nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7945,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7946 ierr = VecCreate(comm_n,&nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7946,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7947 ierr = VecSetSizes(nnsp_vec[0],new_local_rows,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7947,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7948 ierr = VecSetType(nnsp_vec[0],VECSTANDARD"standard");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7948,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7949 /* set values */
7950 ptr_vals = recv_buffer_vecs;
7951 ptr_idxs = recv_buffer_idxs_local;
7952 ierr = VecGetArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7952,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7953 for (i=0;i<n_recvs;i++) {
7954 PetscInt j;
7955 for (j=0;j<*(ptr_idxs+1);j++) {
7956 send_buffer_vecs[*(ptr_idxs+2+j)] += *(ptr_vals + j);
7957 }
7958 ptr_idxs += olengths_idxs[i];
7959 ptr_vals += olengths_idxs[i]-2;
7960 }
7961 ierr = VecRestoreArray(nnsp_vec[0],&send_buffer_vecs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7961,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7962 ierr = VecAssemblyBegin(nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7962,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7963 ierr = VecAssemblyEnd(nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7963,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7964 }
7965
7966 ierr = PetscFree(recv_buffer_vecs)((*PetscTrFree)((void*)(recv_buffer_vecs),7966,__func__,"/sandbox/petsc/petsc.master/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),7966,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7967 ierr = PetscFree(recv_buffer_idxs_local)((*PetscTrFree)((void*)(recv_buffer_idxs_local),7967,__func__
,"/sandbox/petsc/petsc.master/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),7967,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7968 ierr = PetscFree(recv_req_idxs)((*PetscTrFree)((void*)(recv_req_idxs),7968,__func__,"/sandbox/petsc/petsc.master/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),7968,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7969 ierr = PetscFree(recv_req_vals)((*PetscTrFree)((void*)(recv_req_vals),7969,__func__,"/sandbox/petsc/petsc.master/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),7969,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7970 ierr = PetscFree(recv_req_vecs)((*PetscTrFree)((void*)(recv_req_vecs),7970,__func__,"/sandbox/petsc/petsc.master/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),7970,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7971 ierr = PetscFree(recv_req_idxs_is)((*PetscTrFree)((void*)(recv_req_idxs_is),7971,__func__,"/sandbox/petsc/petsc.master/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),7971,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7972 ierr = PetscFree(send_req_idxs)((*PetscTrFree)((void*)(send_req_idxs),7972,__func__,"/sandbox/petsc/petsc.master/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),7972,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7973 ierr = PetscFree(send_req_vals)((*PetscTrFree)((void*)(send_req_vals),7973,__func__,"/sandbox/petsc/petsc.master/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),7973,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7974 ierr = PetscFree(send_req_vecs)((*PetscTrFree)((void*)(send_req_vecs),7974,__func__,"/sandbox/petsc/petsc.master/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),7974,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7975 ierr = PetscFree(send_req_idxs_is)((*PetscTrFree)((void*)(send_req_idxs_is),7975,__func__,"/sandbox/petsc/petsc.master/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),7975,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7976 ierr = PetscFree(ilengths_vals)((*PetscTrFree)((void*)(ilengths_vals),7976,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ilengths_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7976,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7977 ierr = PetscFree(ilengths_idxs)((*PetscTrFree)((void*)(ilengths_idxs),7977,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((ilengths_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7977,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7978 ierr = PetscFree(olengths_vals)((*PetscTrFree)((void*)(olengths_vals),7978,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((olengths_vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7978,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7979 ierr = PetscFree(olengths_idxs)((*PetscTrFree)((void*)(olengths_idxs),7979,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((olengths_idxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7979,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7980 ierr = PetscFree(onodes)((*PetscTrFree)((void*)(onodes),7980,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((onodes) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7980,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7981 if (nis) {
7982 ierr = PetscFree(ilengths_idxs_is)((*PetscTrFree)((void*)(ilengths_idxs_is),7982,__func__,"/sandbox/petsc/petsc.master/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),7982,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7983 ierr = PetscFree(olengths_idxs_is)((*PetscTrFree)((void*)(olengths_idxs_is),7983,__func__,"/sandbox/petsc/petsc.master/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),7983,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7984 ierr = PetscFree(onodes_is)((*PetscTrFree)((void*)(onodes_is),7984,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((onodes_is) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7984,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7985 }
7986 ierr = PetscSubcommDestroy(&subcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7986,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7987 if (destroy_mat) { /* destroy mat is true only if restrict comm is true and process will not partecipate */
7988 ierr = MatDestroy(mat_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7988,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7989 for (i=0;i<nis;i++) {
7990 ierr = ISDestroy(&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7990,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7991 }
7992 if (nvecs) { /* need to match VecDestroy nnsp_vec called in the other code path */
7993 ierr = VecDestroy(&nnsp_vec[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7993,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7994 }
7995 *mat_n = NULL((void*)0);
7996 }
7997 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
7998}
7999
8000/* temporary hack into ksp private data structure */
8001#include <petsc/private/kspimpl.h>
8002
8003PetscErrorCode PCBDDCSetUpCoarseSolver(PC pc,PetscScalar* coarse_submat_vals)
8004{
8005 PC_BDDC *pcbddc = (PC_BDDC*)pc->data;
8006 PC_IS *pcis = (PC_IS*)pc->data;
8007 Mat coarse_mat,coarse_mat_is,coarse_submat_dense;
8008 Mat coarsedivudotp = NULL((void*)0);
8009 Mat coarseG,t_coarse_mat_is;
8010 MatNullSpace CoarseNullSpace = NULL((void*)0);
8011 ISLocalToGlobalMapping coarse_islg;
8012 IS coarse_is,*isarray,corners;
8013 PetscInt i,im_active=-1,active_procs=-1;
8014 PetscInt nis,nisdofs,nisneu,nisvert;
8015 PetscInt coarse_eqs_per_proc;
8016 PC pc_temp;
8017 PCType coarse_pc_type;
8018 KSPType coarse_ksp_type;
8019 PetscBool multilevel_requested,multilevel_allowed;
8020 PetscBool coarse_reuse;
8021 PetscInt ncoarse,nedcfield;
8022 PetscBool compute_vecs = PETSC_FALSE;
8023 PetscScalar *array;
8024 MatReuse coarse_mat_reuse;
8025 PetscBool restr, full_restr, have_void;
8026 PetscMPIInt size;
8027 PetscErrorCode ierr;
8028
8029 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8029; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8030 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),8030,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8031 /* Assign global numbering to coarse dofs */
8032 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 */
8033 PetscInt ocoarse_size;
8034 compute_vecs = PETSC_TRUE;
8035
8036 pcbddc->new_primal_space = PETSC_TRUE;
8037 ocoarse_size = pcbddc->coarse_size;
8038 ierr = PetscFree(pcbddc->global_primal_indices)((*PetscTrFree)((void*)(pcbddc->global_primal_indices),8038
,__func__,"/sandbox/petsc/petsc.master/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),8038,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8039 ierr = PCBDDCComputePrimalNumbering(pc,&pcbddc->coarse_size,&pcbddc->global_primal_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8039,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8040 /* see if we can avoid some work */
8041 if (pcbddc->coarse_ksp) { /* coarse ksp has already been created */
8042 /* if the coarse size is different or we are using adaptive selection, better to not reuse the coarse matrix */
8043 if (ocoarse_size != pcbddc->coarse_size || pcbddc->adaptive_selection) {
8044 ierr = KSPReset(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8044,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8045 coarse_reuse = PETSC_FALSE;
8046 } else { /* we can safely reuse already computed coarse matrix */
8047 coarse_reuse = PETSC_TRUE;
8048 }
8049 } else { /* there's no coarse ksp, so we need to create the coarse matrix too */
8050 coarse_reuse = PETSC_FALSE;
8051 }
8052 /* reset any subassembling information */
8053 if (!coarse_reuse || pcbddc->recompute_topography) {
8054 ierr = ISDestroy(&pcbddc->coarse_subassembling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8054,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8055 }
8056 } else { /* primal space is unchanged, so we can reuse coarse matrix */
8057 coarse_reuse = PETSC_TRUE;
8058 }
8059 if (coarse_reuse && pcbddc->coarse_ksp) {
8060 ierr = KSPGetOperators(pcbddc->coarse_ksp,&coarse_mat,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8060,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8061 ierr = PetscObjectReference((PetscObject)coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8061,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8062 coarse_mat_reuse = MAT_REUSE_MATRIX;
8063 } else {
8064 coarse_mat = NULL((void*)0);
8065 coarse_mat_reuse = MAT_INITIAL_MATRIX;
8066 }
8067
8068 /* creates temporary l2gmap and IS for coarse indexes */
8069 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),8069,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8070 ierr = ISLocalToGlobalMappingCreateIS(coarse_is,&coarse_islg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8070,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8071
8072 /* creates temporary MATIS object for coarse matrix */
8073 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),8073,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8074 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),8074,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8075 ierr = MatISSetLocalMat(t_coarse_mat_is,coarse_submat_dense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8075,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8076 ierr = MatAssemblyBegin(t_coarse_mat_is,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8076,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8077 ierr = MatAssemblyEnd(t_coarse_mat_is,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8077,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8078 ierr = MatDestroy(&coarse_submat_dense);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8078,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8079
8080 /* count "active" (i.e. with positive local size) and "void" processes */
8081 im_active = !!(pcis->n);
8082 ierr = MPIU_Allreduce(&im_active,&active_procs,1,MPIU_INT,MPI_SUM,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8082,__func__,"/sandbox/petsc/petsc.master/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),8082,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8083
8084 /* determine number of processes partecipating to coarse solver and compute subassembling pattern */
8085 /* restr : whether if we want to exclude senders (which are not receivers) from the subassembling pattern */
8086 /* full_restr : just use the receivers from the subassembling pattern */
8087 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)pc),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8087,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8088 coarse_mat_is = NULL((void*)0);
8089 multilevel_allowed = PETSC_FALSE;
8090 multilevel_requested = PETSC_FALSE;
8091 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
))
;
8092 if (coarse_eqs_per_proc < 0) coarse_eqs_per_proc = pcbddc->coarse_size;
8093 if (pcbddc->current_level < pcbddc->max_levels) multilevel_requested = PETSC_TRUE;
8094 if (pcbddc->coarse_size <= pcbddc->coarse_eqs_limit) multilevel_requested = PETSC_FALSE;
8095 if (multilevel_requested) {
8096 ncoarse = active_procs/pcbddc->coarsening_ratio;
8097 restr = PETSC_FALSE;
8098 full_restr = PETSC_FALSE;
8099 } else {
8100 ncoarse = pcbddc->coarse_size/coarse_eqs_per_proc + !!(pcbddc->coarse_size%coarse_eqs_per_proc);
8101 restr = PETSC_TRUE;
8102 full_restr = PETSC_TRUE;
8103 }
8104 if (!pcbddc->coarse_size || size == 1) multilevel_allowed = multilevel_requested = restr = full_restr = PETSC_FALSE;
8105 ncoarse = PetscMax(1,ncoarse)(((1)<(ncoarse)) ? (ncoarse) : (1));
8106 if (!pcbddc->coarse_subassembling) {
8107 if (pcbddc->coarsening_ratio > 1) {
8108 if (multilevel_requested) {
8109 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),8109,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8110 } else {
8111 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),8111,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8112 }
8113 } else {
8114 PetscMPIInt rank;
8115 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)pc),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8115,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8116 have_void = (active_procs == (PetscInt)size) ? PETSC_FALSE : PETSC_TRUE;
8117 ierr = ISCreateStride(PetscObjectComm((PetscObject)pc),1,rank,1,&pcbddc->coarse_subassembling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8117,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8118 }
8119 } else { /* if a subassembling pattern exists, then we can reuse the coarse ksp and compute the number of process involved */
8120 PetscInt psum;
8121 if (pcbddc->coarse_ksp) psum = 1;
8122 else psum = 0;
8123 ierr = MPIU_Allreduce(&psum,&ncoarse,1,MPIU_INT,MPI_SUM,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8123,__func__,"/sandbox/petsc/petsc.master/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),8123,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8124 have_void = ncoarse < size ? PETSC_TRUE : PETSC_FALSE;
8125 }
8126 /* determine if we can go multilevel */
8127 if (multilevel_requested) {
8128 if (ncoarse > 1) multilevel_allowed = PETSC_TRUE; /* found enough processes */
8129 else restr = full_restr = PETSC_TRUE; /* 1 subdomain, use a direct solver */
8130 }
8131 if (multilevel_allowed && have_void) restr = PETSC_TRUE;
8132
8133 /* dump subassembling pattern */
8134 if (pcbddc->dbg_flag && multilevel_allowed) {
8135 ierr = ISView(pcbddc->coarse_subassembling,pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8135,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8136 }
8137 /* compute dofs splitting and neumann boundaries for coarse dofs */
8138 nedcfield = -1;
8139 corners = NULL((void*)0);
8140 if (multilevel_allowed && !coarse_reuse && (pcbddc->n_ISForDofsLocal || pcbddc->NeumannBoundariesLocal || pcbddc->nedclocal || pcbddc->corner_selected)) { /* protects from unneded computations */
8141 PetscInt *tidxs,*tidxs2,nout,tsize,i;
8142 const PetscInt *idxs;
8143 ISLocalToGlobalMapping tmap;
8144
8145 /* create map between primal indices (in local representative ordering) and local primal numbering */
8146 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),8146,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8147 /* allocate space for temporary storage */
8148 ierr = PetscMalloc1(pcbddc->local_primal_size,&tidxs)PetscMallocA(1,PETSC_FALSE,8148,__func__,"/sandbox/petsc/petsc.master/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),8148,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8149 ierr = PetscMalloc1(pcbddc->local_primal_size,&tidxs2)PetscMallocA(1,PETSC_FALSE,8149,__func__,"/sandbox/petsc/petsc.master/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),8149,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8150 /* allocate for IS array */
8151 nisdofs = pcbddc->n_ISForDofsLocal;
8152 if (pcbddc->nedclocal) {
8153 if (pcbddc->nedfield > -1) {
8154 nedcfield = pcbddc->nedfield;
8155 } else {
8156 nedcfield = 0;
8157 if (nisdofs) SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"This should not happen (%D)",nisdofs)return PetscError(PetscObjectComm((PetscObject)pc),8157,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen (%D)",nisdofs
)
;
8158 nisdofs = 1;
8159 }
8160 }
8161 nisneu = !!pcbddc->NeumannBoundariesLocal;
8162 nisvert = 0; /* nisvert is not used */
8163 nis = nisdofs + nisneu + nisvert;
8164 ierr = PetscMalloc1(nis,&isarray)PetscMallocA(1,PETSC_FALSE,8164,__func__,"/sandbox/petsc/petsc.master/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),8164,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8165 /* dofs splitting */
8166 for (i=0;i<nisdofs;i++) {
8167 /* ierr = ISView(pcbddc->ISForDofsLocal[i],0);CHKERRQ(ierr); */
8168 if (nedcfield != i) {
8169 ierr = ISGetLocalSize(pcbddc->ISForDofsLocal[i],&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8169,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8170 ierr = ISGetIndices(pcbddc->ISForDofsLocal[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8170,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8171 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8171,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8172 ierr = ISRestoreIndices(pcbddc->ISForDofsLocal[i],&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8172,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8173 } else {
8174 ierr = ISGetLocalSize(pcbddc->nedclocal,&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8174,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8175 ierr = ISGetIndices(pcbddc->nedclocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8175,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8176 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8176,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8177 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),8177,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Failed when mapping coarse nedelec field! %D != %D"
,tsize,nout)
;
8178 ierr = ISRestoreIndices(pcbddc->nedclocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8178,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8179 }
8180 ierr = ISLocalToGlobalMappingApply(coarse_islg,nout,tidxs,tidxs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8180,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8181 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),8181,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8182 /* ierr = ISView(isarray[i],0);CHKERRQ(ierr); */
8183 }
8184 /* neumann boundaries */
8185 if (pcbddc->NeumannBoundariesLocal) {
8186 /* ierr = ISView(pcbddc->NeumannBoundariesLocal,0);CHKERRQ(ierr); */
8187 ierr = ISGetLocalSize(pcbddc->NeumannBoundariesLocal,&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8187,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8188 ierr = ISGetIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8188,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8189 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8189,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8190 ierr = ISRestoreIndices(pcbddc->NeumannBoundariesLocal,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8190,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8191 ierr = ISLocalToGlobalMappingApply(coarse_islg,nout,tidxs,tidxs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8191,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8192 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),8192,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8193 /* ierr = ISView(isarray[nisdofs],0);CHKERRQ(ierr); */
8194 }
8195 /* coordinates */
8196 if (pcbddc->corner_selected) {
8197 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),8197,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8198 ierr = ISGetLocalSize(corners,&tsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8198,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8199 ierr = ISGetIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8199,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8200 ierr = ISGlobalToLocalMappingApply(tmap,IS_GTOLM_DROP,tsize,idxs,&nout,tidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8200,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8201 if (tsize != nout) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Failed when mapping corners! %D != %D",tsize,nout)return PetscError(((MPI_Comm)0x44000001),8201,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Failed when mapping corners! %D != %D"
,tsize,nout)
;
8202 ierr = ISRestoreIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8202,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8203 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),8203,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8204 ierr = ISLocalToGlobalMappingApply(coarse_islg,nout,tidxs,tidxs2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8204,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8205 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),nout,tidxs2,PETSC_COPY_VALUES,&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8205,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8206 }
8207 ierr = PetscFree(tidxs)((*PetscTrFree)((void*)(tidxs),8207,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8207,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8208 ierr = PetscFree(tidxs2)((*PetscTrFree)((void*)(tidxs2),8208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((tidxs2) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8209 ierr = ISLocalToGlobalMappingDestroy(&tmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8209,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8210 } else {
8211 nis = 0;
8212 nisdofs = 0;
8213 nisneu = 0;
8214 nisvert = 0;
8215 isarray = NULL((void*)0);
8216 }
8217 /* destroy no longer needed map */
8218 ierr = ISLocalToGlobalMappingDestroy(&coarse_islg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8218,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8219
8220 /* subassemble */
8221 if (multilevel_allowed) {
8222 Vec vp[1];
8223 PetscInt nvecs = 0;
8224 PetscBool reuse,reuser;
8225
8226 if (coarse_mat) reuse = PETSC_TRUE;
8227 else reuse = PETSC_FALSE;
8228 ierr = MPIU_Allreduce(&reuse,&reuser,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8228,__func__,"/sandbox/petsc/petsc.master/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),8228,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8229 vp[0] = NULL((void*)0);
8230 if (pcbddc->benign_have_null) { /* propagate no-net-flux quadrature to coarser level */
8231 ierr = VecCreate(PetscObjectComm((PetscObject)pc),&vp[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8231,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8232 ierr = VecSetSizes(vp[0],pcbddc->local_primal_size,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8232,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8233 ierr = VecSetType(vp[0],VECSTANDARD"standard");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8233,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8234 nvecs = 1;
8235
8236 if (pcbddc->divudotp) {
8237 Mat B,loc_divudotp;
8238 Vec v,p;
8239 IS dummy;
8240 PetscInt np;
8241
8242 ierr = MatISGetLocalMat(pcbddc->divudotp,&loc_divudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8242,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8243 ierr = MatGetSize(loc_divudotp,&np,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8243,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8244 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),8244,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8245 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),8245,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8246 ierr = MatCreateVecs(B,&v,&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8246,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8247 ierr = VecSet(p,1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8247,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8248 ierr = MatMultTranspose(B,p,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8248,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8249 ierr = VecDestroy(&p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8249,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8250 ierr = MatDestroy(&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8251 ierr = VecGetArray(vp[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8251,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8252 ierr = VecPlaceArray(pcbddc->vec1_P,array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8252,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8253 ierr = VecRestoreArray(vp[0],&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8253,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8254 ierr = MatMultTranspose(pcbddc->coarse_phi_B,v,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8254,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8255 ierr = VecResetArray(pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8255,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8256 ierr = ISDestroy(&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8256,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8257 ierr = VecDestroy(&v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8257,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8258 }
8259 }
8260 if (reuser) {
8261 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),8261,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8262 } else {
8263 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),8263,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8264 }
8265 if (vp[0]) { /* vp[0] could have been placed on a different set of processes */
8266 PetscScalar *arraym;
8267 const PetscScalar *arrayv;
8268 PetscInt nl;
8269 ierr = VecGetLocalSize(vp[0],&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8269,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8270 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),8270,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8271 ierr = MatDenseGetArray(coarsedivudotp,&arraym);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8271,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8272 ierr = VecGetArrayRead(vp[0],&arrayv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8272,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8273 ierr = PetscArraycpy(arraym,arrayv,nl)((sizeof(*(arraym)) != sizeof(*(arrayv))) || PetscMemcpy(arraym
,arrayv,(nl)*sizeof(*(arraym))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8273,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8274 ierr = VecRestoreArrayRead(vp[0],&arrayv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8274,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8275 ierr = MatDenseRestoreArray(coarsedivudotp,&arraym);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8275,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8276 ierr = VecDestroy(&vp[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8276,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8277 } else {
8278 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),8278,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8279 }
8280 } else {
8281 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),8281,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8282 }
8283 if (coarse_mat_is || coarse_mat) {
8284 if (!multilevel_allowed) {
8285 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),8285,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8286 } else {
8287 Mat A;
8288
8289 /* if this matrix is present, it means we are not reusing the coarse matrix */
8290 if (coarse_mat_is) {
8291 if (coarse_mat) SETERRQ(PetscObjectComm((PetscObject)coarse_mat_is),PETSC_ERR_PLIB,"This should not happen")return PetscError(PetscObjectComm((PetscObject)coarse_mat_is)
,8291,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"This should not happen")
;
8292 ierr = PetscObjectReference((PetscObject)coarse_mat_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8292,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8293 coarse_mat = coarse_mat_is;
8294 }
8295 /* be sure we don't have MatSeqDENSE as local mat */
8296 ierr = MatISGetLocalMat(coarse_mat,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8296,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8297 ierr = MatConvert(A,MATSEQAIJ"seqaij",MAT_INPLACE_MATRIX,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8297,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8298 }
8299 }
8300 ierr = MatDestroy(&t_coarse_mat_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8300,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8301 ierr = MatDestroy(&coarse_mat_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8301,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8302
8303 /* create local to global scatters for coarse problem */
8304 if (compute_vecs) {
8305 PetscInt lrows;
8306 ierr = VecDestroy(&pcbddc->coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8306,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8307 if (coarse_mat) {
8308 ierr = MatGetLocalSize(coarse_mat,&lrows,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8308,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8309 } else {
8310 lrows = 0;
8311 }
8312 ierr = VecCreate(PetscObjectComm((PetscObject)pc),&pcbddc->coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8312,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8313 ierr = VecSetSizes(pcbddc->coarse_vec,lrows,PETSC_DECIDE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8313,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8314 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),8314,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8315 ierr = VecScatterDestroy(&pcbddc->coarse_loc_to_glob);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8315,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8316 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),8316,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8317 }
8318 ierr = ISDestroy(&coarse_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8318,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8319
8320 /* set defaults for coarse KSP and PC */
8321 if (multilevel_allowed) {
8322 coarse_ksp_type = KSPRICHARDSON"richardson";
8323 coarse_pc_type = PCBDDC"bddc";
8324 } else {
8325 coarse_ksp_type = KSPPREONLY"preonly";
8326 coarse_pc_type = PCREDUNDANT"redundant";
8327 }
8328
8329 /* print some info if requested */
8330 if (pcbddc->dbg_flag) {
8331 if (!multilevel_allowed) {
8332 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8332,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8333 if (multilevel_requested) {
8334 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),8334,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8335 } else if (pcbddc->max_levels) {
8336 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),8336,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8337 }
8338 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8338,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8339 }
8340 }
8341
8342 /* communicate coarse discrete gradient */
8343 coarseG = NULL((void*)0);
8344 if (pcbddc->nedcG && multilevel_allowed) {
8345 MPI_Comm ccomm;
8346 if (coarse_mat) {
8347 ccomm = PetscObjectComm((PetscObject)coarse_mat);
8348 } else {
8349 ccomm = MPI_COMM_NULL((MPI_Comm)0x04000000);
8350 }
8351 ierr = MatMPIAIJRestrict(pcbddc->nedcG,ccomm,&coarseG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8351,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8352 }
8353
8354 /* create the coarse KSP object only once with defaults */
8355 if (coarse_mat) {
8356 PetscBool isredundant,isnn,isbddc;
8357 PetscViewer dbg_viewer = NULL((void*)0);
8358
8359 if (pcbddc->dbg_flag) {
8360 dbg_viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)coarse_mat));
8361 ierr = PetscViewerASCIIAddTab(dbg_viewer,2*pcbddc->current_level);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8361,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8362 }
8363 if (!pcbddc->coarse_ksp) {
8364 char prefix[256],str_level[16];
8365 size_t len;
8366
8367 ierr = KSPCreate(PetscObjectComm((PetscObject)coarse_mat),&pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8367,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8368 ierr = KSPSetErrorIfNotConverged(pcbddc->coarse_ksp,pc->erroriffailure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8368,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8369 ierr = PetscObjectIncrementTabLevel((PetscObject)pcbddc->coarse_ksp,(PetscObject)pc,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8369,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8370 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),8370,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8371 ierr = KSPSetOperators(pcbddc->coarse_ksp,coarse_mat,coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8371,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8372 ierr = KSPSetType(pcbddc->coarse_ksp,coarse_ksp_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8372,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8373 ierr = KSPSetNormType(pcbddc->coarse_ksp,KSP_NORM_NONE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8373,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8374 ierr = KSPGetPC(pcbddc->coarse_ksp,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8374,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8375 /* TODO is this logic correct? should check for coarse_mat type */
8376 ierr = PCSetType(pc_temp,coarse_pc_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8376,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8377 /* prefix */
8378 ierr = PetscStrcpy(prefix,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8378,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8379 ierr = PetscStrcpy(str_level,"");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8379,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8380 if (!pcbddc->current_level) {
8381 ierr = PetscStrncpy(prefix,((PetscObject)pc)->prefix,sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8381,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8382 ierr = PetscStrlcat(prefix,"pc_bddc_coarse_",sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8382,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8383 } else {
8384 ierr = PetscStrlen(((PetscObject)pc)->prefix,&len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8384,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8385 if (pcbddc->current_level>1) len -= 3; /* remove "lX_" with X level number */
8386 if (pcbddc->current_level>10) len -= 1; /* remove another char from level number */
8387 /* Nonstandard use of PetscStrncpy() to copy only a portion of the string */
8388 ierr = PetscStrncpy(prefix,((PetscObject)pc)->prefix,len+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8388,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8389 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),8389,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8390 ierr = PetscStrlcat(prefix,str_level,sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8390,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8391 }
8392 ierr = KSPSetOptionsPrefix(pcbddc->coarse_ksp,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8392,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8393 /* propagate BDDC info to the next level (these are dummy calls if pc_temp is not of type PCBDDC) */
8394 ierr = PCBDDCSetLevel(pc_temp,pcbddc->current_level+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8394,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8395 ierr = PCBDDCSetCoarseningRatio(pc_temp,pcbddc->coarsening_ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8395,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8396 ierr = PCBDDCSetLevels(pc_temp,pcbddc->max_levels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8396,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8397 /* allow user customization */
8398 ierr = KSPSetFromOptions(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8398,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8399 /* get some info after set from options */
8400 ierr = KSPGetPC(pcbddc->coarse_ksp,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8400,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8401 /* multilevel cannot be done with coarse PCs different from BDDC or NN */
8402 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8402,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8403 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCNN"nn",&isnn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8403,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8404 if (multilevel_allowed && !isbddc && !isnn) {
8405 isbddc = PETSC_TRUE;
8406 ierr = PCSetType(pc_temp,PCBDDC"bddc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8406,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8407 ierr = PCBDDCSetLevel(pc_temp,pcbddc->current_level+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8407,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8408 ierr = PCBDDCSetCoarseningRatio(pc_temp,pcbddc->coarsening_ratio);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8408,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8409 ierr = PCBDDCSetLevels(pc_temp,pcbddc->max_levels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8409,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8410 if (pc_temp->ops->setfromoptions) { /* need to setfromoptions again, skipping the pc_type */
8411 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),8411
,__func__,"/sandbox/petsc/petsc.master/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),8411,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8412 ierr = (*pc_temp->ops->setfromoptions)(PetscOptionsObject,pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8412,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8413 ierr = PetscObjectProcessOptionsHandlers(PetscOptionsObject,(PetscObject)pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8413,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8414 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8414,__func__,"/sandbox/petsc/petsc.master/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),8414,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8415 pc_temp->setfromoptionscalled++;
8416 }
8417 }
8418 }
8419 /* propagate BDDC info to the next level (these are dummy calls if pc_temp is not of type PCBDDC) */
8420 ierr = KSPGetPC(pcbddc->coarse_ksp,&pc_temp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8420,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8421 if (nisdofs) {
8422 ierr = PCBDDCSetDofsSplitting(pc_temp,nisdofs,isarray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8422,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8423 for (i=0;i<nisdofs;i++) {
8424 ierr = ISDestroy(&isarray[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8424,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8425 }
8426 }
8427 if (nisneu) {
8428 ierr = PCBDDCSetNeumannBoundaries(pc_temp,isarray[nisdofs]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8428,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8429 ierr = ISDestroy(&isarray[nisdofs]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8429,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8430 }
8431 if (nisvert) {
8432 ierr = PCBDDCSetPrimalVerticesIS(pc_temp,isarray[nis-1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8432,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8433 ierr = ISDestroy(&isarray[nis-1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8433,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8434 }
8435 if (coarseG) {
8436 ierr = PCBDDCSetDiscreteGradient(pc_temp,coarseG,1,nedcfield,PETSC_FALSE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8436,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8437 }
8438
8439 /* get some info after set from options */
8440 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8440,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8441
8442 /* multilevel can only be requested via -pc_bddc_levels or PCBDDCSetLevels */
8443 if (isbddc && !multilevel_allowed) {
8444 ierr = PCSetType(pc_temp,coarse_pc_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8444,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8445 isbddc = PETSC_FALSE;
8446 }
8447 /* multilevel cannot be done with coarse PCs different from BDDC or NN */
8448 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCNN"nn",&isnn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8448,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8449 if (multilevel_requested && multilevel_allowed && !isbddc && !isnn) {
8450 ierr = PCSetType(pc_temp,PCBDDC"bddc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8450,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8451 isbddc = PETSC_TRUE;
8452 }
8453 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCREDUNDANT"redundant",&isredundant);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8453,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8454 if (isredundant) {
8455 KSP inner_ksp;
8456 PC inner_pc;
8457
8458 ierr = PCRedundantGetKSP(pc_temp,&inner_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8458,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8459 ierr = KSPGetPC(inner_ksp,&inner_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8459,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8460 }
8461
8462 /* parameters which miss an API */
8463 ierr = PetscObjectTypeCompare((PetscObject)pc_temp,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8463,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8464 if (isbddc) {
8465 PC_BDDC* pcbddc_coarse = (PC_BDDC*)pc_temp->data;
8466
8467 pcbddc_coarse->detect_disconnected = PETSC_TRUE;
8468 pcbddc_coarse->coarse_eqs_per_proc = pcbddc->coarse_eqs_per_proc;
8469 pcbddc_coarse->coarse_eqs_limit = pcbddc->coarse_eqs_limit;
8470 pcbddc_coarse->benign_saddle_point = pcbddc->benign_have_null;
8471 if (pcbddc_coarse->benign_saddle_point) {
8472 Mat coarsedivudotp_is;
8473 ISLocalToGlobalMapping l2gmap,rl2g,cl2g;
8474 IS row,col;
8475 const PetscInt *gidxs;
8476 PetscInt n,st,M,N;
8477
8478 ierr = MatGetSize(coarsedivudotp,&n,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8478,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8479 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),8479,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8480 st = st-n;
8481 ierr = ISCreateStride(PetscObjectComm((PetscObject)coarse_mat),1,st,1,&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8481,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8482 ierr = MatGetLocalToGlobalMapping(coarse_mat,&l2gmap,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8482,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8483 ierr = ISLocalToGlobalMappingGetSize(l2gmap,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8483,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8484 ierr = ISLocalToGlobalMappingGetIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8484,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8485 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),8485,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8486 ierr = ISLocalToGlobalMappingRestoreIndices(l2gmap,&gidxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8486,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8487 ierr = ISLocalToGlobalMappingCreateIS(row,&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8487,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8488 ierr = ISLocalToGlobalMappingCreateIS(col,&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8488,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8489 ierr = ISGetSize(row,&M);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8489,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8490 ierr = MatGetSize(coarse_mat,&N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8490,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8491 ierr = ISDestroy(&row);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8491,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8492 ierr = ISDestroy(&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8492,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8493 ierr = MatCreate(PetscObjectComm((PetscObject)coarse_mat),&coarsedivudotp_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8493,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8494 ierr = MatSetType(coarsedivudotp_is,MATIS"is");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8494,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8495 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),8495,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8496 ierr = MatSetLocalToGlobalMapping(coarsedivudotp_is,rl2g,cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8496,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8497 ierr = ISLocalToGlobalMappingDestroy(&rl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8497,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8498 ierr = ISLocalToGlobalMappingDestroy(&cl2g);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8498,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8499 ierr = MatISSetLocalMat(coarsedivudotp_is,coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8499,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8500 ierr = MatDestroy(&coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8500,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8501 ierr = PCBDDCSetDivergenceMat(pc_temp,coarsedivudotp_is,PETSC_FALSE,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8501,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8502 ierr = MatDestroy(&coarsedivudotp_is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8502,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8503 pcbddc_coarse->adaptive_userdefined = PETSC_TRUE;
8504 if (pcbddc->adaptive_threshold[0] == 0.0) pcbddc_coarse->deluxe_zerorows = PETSC_TRUE;
8505 }
8506 }
8507
8508 /* propagate symmetry info of coarse matrix */
8509 ierr = MatSetOption(coarse_mat,MAT_STRUCTURALLY_SYMMETRIC,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8509,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8510 if (pc->pmat->symmetric_set) {
8511 ierr = MatSetOption(coarse_mat,MAT_SYMMETRIC,pc->pmat->symmetric);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8511,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8512 }
8513 if (pc->pmat->hermitian_set) {
8514 ierr = MatSetOption(coarse_mat,MAT_HERMITIAN,pc->pmat->hermitian);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8514,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8515 }
8516 if (pc->pmat->spd_set) {
8517 ierr = MatSetOption(coarse_mat,MAT_SPD,pc->pmat->spd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8517,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8518 }
8519 if (pcbddc->benign_saddle_point && !pcbddc->benign_have_null) {
8520 ierr = MatSetOption(coarse_mat,MAT_SPD,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8520,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8521 }
8522 /* set operators */
8523 ierr = MatViewFromOptions(coarse_mat,(PetscObject)pc,"-pc_bddc_coarse_mat_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8523,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8524 ierr = MatSetOptionsPrefix(coarse_mat,((PetscObject)pcbddc->coarse_ksp)->prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8524,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8525 ierr = KSPSetOperators(pcbddc->coarse_ksp,coarse_mat,coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8525,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8526 if (pcbddc->dbg_flag) {
8527 ierr = PetscViewerASCIISubtractTab(dbg_viewer,2*pcbddc->current_level);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8527,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8528 }
8529 }
8530 ierr = MatDestroy(&coarseG);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8530,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8531 ierr = PetscFree(isarray)((*PetscTrFree)((void*)(isarray),8531,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((isarray) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8531,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8532#if 0
8533 {
8534 PetscViewer viewer;
8535 char filename[256];
8536 sprintf(filename,"coarse_mat_level%d.m",pcbddc->current_level);
8537 ierr = PetscViewerASCIIOpen(PetscObjectComm((PetscObject)coarse_mat),filename,&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8537,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8538 ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_MATLAB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8538,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8539 ierr = MatView(coarse_mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8539,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8540 ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8540,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8541 ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8541,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8542 }
8543#endif
8544
8545 if (corners) {
8546 Vec gv;
8547 IS is;
8548 const PetscInt *idxs;
8549 PetscInt i,d,N,n,cdim = pcbddc->mat_graph->cdim;
8550 PetscScalar *coords;
8551
8552 if (!pcbddc->mat_graph->cloc) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Missing local coordinates")return PetscError(((MPI_Comm)0x44000001),8552,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"Missing local coordinates")
;
8553 ierr = VecGetSize(pcbddc->coarse_vec,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8553,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8554 ierr = VecGetLocalSize(pcbddc->coarse_vec,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8554,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8555 ierr = VecCreate(PetscObjectComm((PetscObject)pcbddc->coarse_vec),&gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8555,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8556 ierr = VecSetBlockSize(gv,cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8556,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8557 ierr = VecSetSizes(gv,n*cdim,N*cdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8557,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8558 ierr = VecSetType(gv,VECSTANDARD"standard");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8558,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8559 ierr = VecSetFromOptions(gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8559,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8560 ierr = VecSet(gv,PETSC_MAX_REAL1.7976931348623157e+308);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8560,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* we only propagate coordinates from vertices constraints */
8561
8562 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),8562,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8563 ierr = ISGetLocalSize(is,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8563,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8564 ierr = ISGetIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8564,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8565 ierr = PetscMalloc1(n*cdim,&coords)PetscMallocA(1,PETSC_FALSE,8565,__func__,"/sandbox/petsc/petsc.master/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),8565,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8566 for (i=0;i<n;i++) {
8567 for (d=0;d<cdim;d++) {
8568 coords[cdim*i+d] = pcbddc->mat_graph->coords[cdim*idxs[i]+d];
8569 }
8570 }
8571 ierr = ISRestoreIndices(is,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8571,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8572 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),8572,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8573
8574 ierr = ISGetLocalSize(corners,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8574,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8575 ierr = ISGetIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8575,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8576 ierr = VecSetValuesBlocked(gv,n,idxs,coords,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8576,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8577 ierr = ISRestoreIndices(corners,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8577,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8578 ierr = PetscFree(coords)((*PetscTrFree)((void*)(coords),8578,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((coords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8578,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8579 ierr = VecAssemblyBegin(gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8579,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8580 ierr = VecAssemblyEnd(gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8580,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8581 ierr = VecGetArray(gv,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8581,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8582 if (pcbddc->coarse_ksp) {
8583 PC coarse_pc;
8584 PetscBool isbddc;
8585
8586 ierr = KSPGetPC(pcbddc->coarse_ksp,&coarse_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8586,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8587 ierr = PetscObjectTypeCompare((PetscObject)coarse_pc,PCBDDC"bddc",&isbddc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8587,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8588 if (isbddc) { /* coarse coordinates have PETSC_MAX_REAL, specific for BDDC */
8589 PetscReal *realcoords;
8590
8591 ierr = VecGetLocalSize(gv,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8591,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8592#if defined(PETSC_USE_COMPLEX)
8593 ierr = PetscMalloc1(n,&realcoords)PetscMallocA(1,PETSC_FALSE,8593,__func__,"/sandbox/petsc/petsc.master/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),8593,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8594 for (i=0;i<n;i++) realcoords[i] = PetscRealPart(coords[i])(coords[i]);
8595#else
8596 realcoords = coords;
8597#endif
8598 ierr = PCSetCoordinates(coarse_pc,cdim,n/cdim,realcoords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8598,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8599#if defined(PETSC_USE_COMPLEX)
8600 ierr = PetscFree(realcoords)((*PetscTrFree)((void*)(realcoords),8600,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((realcoords) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8600,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8601#endif
8602 }
8603 }
8604 ierr = VecRestoreArray(gv,&coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8604,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8605 ierr = VecDestroy(&gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8605,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8606 }
8607 ierr = ISDestroy(&corners);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8607,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8608
8609 if (pcbddc->coarse_ksp) {
8610 Vec crhs,csol;
8611
8612 ierr = KSPGetSolution(pcbddc->coarse_ksp,&csol);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8612,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8613 ierr = KSPGetRhs(pcbddc->coarse_ksp,&crhs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8613,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8614 if (!csol) {
8615 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),8615,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8616 }
8617 if (!crhs) {
8618 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),8618,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8619 }
8620 }
8621 ierr = MatDestroy(&coarsedivudotp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8621,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8622
8623 /* compute null space for coarse solver if the benign trick has been requested */
8624 if (pcbddc->benign_null) {
8625
8626 ierr = VecSet(pcbddc->vec1_P,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8626,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8627 for (i=0;i<pcbddc->benign_n;i++) {
8628 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),8628,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8629 }
8630 ierr = VecAssemblyBegin(pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8630,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8631 ierr = VecAssemblyEnd(pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8631,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8632 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),8632,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8633 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),8633,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8634 if (coarse_mat) {
8635 Vec nullv;
8636 PetscScalar *array,*array2;
8637 PetscInt nl;
8638
8639 ierr = MatCreateVecs(coarse_mat,&nullv,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8639,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8640 ierr = VecGetLocalSize(nullv,&nl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8640,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8641 ierr = VecGetArrayRead(pcbddc->coarse_vec,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8641,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8642 ierr = VecGetArray(nullv,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8642,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8643 ierr = PetscArraycpy(array2,array,nl)((sizeof(*(array2)) != sizeof(*(array))) || PetscMemcpy(array2
,array,(nl)*sizeof(*(array2))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8643,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8644 ierr = VecRestoreArray(nullv,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8644,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8645 ierr = VecRestoreArrayRead(pcbddc->coarse_vec,(const PetscScalar**)&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8645,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8646 ierr = VecNormalize(nullv,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8646,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8647 ierr = MatNullSpaceCreate(PetscObjectComm((PetscObject)coarse_mat),PETSC_FALSE,1,&nullv,&CoarseNullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8647,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8648 ierr = VecDestroy(&nullv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8648,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8649 }
8650 }
8651 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),8651,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8652
8653 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),8653,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8654 if (pcbddc->coarse_ksp) {
8655 PetscBool ispreonly;
8656
8657 if (CoarseNullSpace) {
8658 PetscBool isnull;
8659 ierr = MatNullSpaceTest(CoarseNullSpace,coarse_mat,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8659,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8660 if (isnull) {
8661 ierr = MatSetNullSpace(coarse_mat,CoarseNullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8661,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8662 }
8663 /* TODO: add local nullspaces (if any) */
8664 }
8665 /* setup coarse ksp */
8666 ierr = KSPSetUp(pcbddc->coarse_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8666,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8667 /* Check coarse problem if in debug mode or if solving with an iterative method */
8668 ierr = PetscObjectTypeCompare((PetscObject)pcbddc->coarse_ksp,KSPPREONLY"preonly",&ispreonly);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8668,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8669 if (pcbddc->dbg_flag || (!ispreonly && pcbddc->use_coarse_estimates) ) {
8670 KSP check_ksp;
8671 KSPType check_ksp_type;
8672 PC check_pc;
8673 Vec check_vec,coarse_vec;
8674 PetscReal abs_infty_error,infty_error,lambda_min=1.0,lambda_max=1.0;
8675 PetscInt its;
8676 PetscBool compute_eigs;
8677 PetscReal *eigs_r,*eigs_c;
8678 PetscInt neigs;
8679 const char *prefix;
8680
8681 /* Create ksp object suitable for estimation of extreme eigenvalues */
8682 ierr = KSPCreate(PetscObjectComm((PetscObject)pcbddc->coarse_ksp),&check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8682,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8683 ierr = PetscObjectIncrementTabLevel((PetscObject)check_ksp,(PetscObject)pcbddc->coarse_ksp,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8683,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8684 ierr = KSPSetErrorIfNotConverged(pcbddc->coarse_ksp,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8684,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8685 ierr = KSPSetOperators(check_ksp,coarse_mat,coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8685,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8686 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),8686,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8687 /* prevent from setup unneeded object */
8688 ierr = KSPGetPC(check_ksp,&check_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8688,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8689 ierr = PCSetType(check_pc,PCNONE"none");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8689,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8690 if (ispreonly) {
8691 check_ksp_type = KSPPREONLY"preonly";
8692 compute_eigs = PETSC_FALSE;
8693 } else {
8694 check_ksp_type = KSPGMRES"gmres";
8695 compute_eigs = PETSC_TRUE;
8696 }
8697 ierr = KSPSetType(check_ksp,check_ksp_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8697,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8698 ierr = KSPSetComputeSingularValues(check_ksp,compute_eigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8698,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8699 ierr = KSPSetComputeEigenvalues(check_ksp,compute_eigs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8699,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8700 ierr = KSPGMRESSetRestart(check_ksp,pcbddc->coarse_size+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8700,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8701 ierr = KSPGetOptionsPrefix(pcbddc->coarse_ksp,&prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8701,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8702 ierr = KSPSetOptionsPrefix(check_ksp,prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8702,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8703 ierr = KSPAppendOptionsPrefix(check_ksp,"check_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8703,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8704 ierr = KSPSetFromOptions(check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8704,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8705 ierr = KSPSetUp(check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8705,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8706 ierr = KSPGetPC(pcbddc->coarse_ksp,&check_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8706,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8707 ierr = KSPSetPC(check_ksp,check_pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8707,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8708 /* create random vec */
8709 ierr = MatCreateVecs(coarse_mat,&coarse_vec,&check_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8709,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8710 ierr = VecSetRandom(check_vec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8710,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8711 ierr = MatMult(coarse_mat,check_vec,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8711,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8712 /* solve coarse problem */
8713 ierr = KSPSolve(check_ksp,coarse_vec,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8713,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8714 ierr = KSPCheckSolve(check_ksp,pc,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8714,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8715 /* set eigenvalue estimation if preonly has not been requested */
8716 if (compute_eigs) {
8717 ierr = PetscMalloc1(pcbddc->coarse_size+1,&eigs_r)PetscMallocA(1,PETSC_FALSE,8717,__func__,"/sandbox/petsc/petsc.master/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),8717,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8718 ierr = PetscMalloc1(pcbddc->coarse_size+1,&eigs_c)PetscMallocA(1,PETSC_FALSE,8718,__func__,"/sandbox/petsc/petsc.master/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),8718,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8719 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),8719,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8720 if (neigs) {
8721 lambda_max = eigs_r[neigs-1];
8722 lambda_min = eigs_r[0];
8723 if (pcbddc->use_coarse_estimates) {
8724 if (lambda_max>=lambda_min) { /* using PETSC_SMALL since lambda_max == lambda_min is not allowed by KSPChebyshevSetEigenvalues */
8725 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),8725,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8726 ierr = KSPRichardsonSetScale(pcbddc->coarse_ksp,2.0/(lambda_max+lambda_min));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8726,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8727 }
8728 }
8729 }
8730 }
8731
8732 /* check coarse problem residual error */
8733 if (pcbddc->dbg_flag) {
8734 PetscViewer dbg_viewer = PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)pcbddc->coarse_ksp));
8735 ierr = PetscViewerASCIIAddTab(dbg_viewer,2*(pcbddc->current_level+1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8735,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8736 ierr = VecAXPY(check_vec,-1.0,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8736,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8737 ierr = VecNorm(check_vec,NORM_INFINITY,&infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8737,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8738 ierr = MatMult(coarse_mat,check_vec,coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8738,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8739 ierr = VecNorm(coarse_vec,NORM_INFINITY,&abs_infty_error);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8739,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8740 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),8740,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8741 ierr = PetscObjectPrintClassNamePrefixType((PetscObject)(pcbddc->coarse_ksp),dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8741,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8742 ierr = PetscObjectPrintClassNamePrefixType((PetscObject)(check_pc),dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8742,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8743 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),8743,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8744 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),8744,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8745 if (CoarseNullSpace) {
8746 ierr = PetscViewerASCIIPrintf(dbg_viewer,"Coarse problem is singular\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8746,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8747 }
8748 if (compute_eigs) {
8749 PetscReal lambda_max_s,lambda_min_s;
8750 KSPConvergedReason reason;
8751 ierr = KSPGetType(check_ksp,&check_ksp_type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8751,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8752 ierr = KSPGetIterationNumber(check_ksp,&its);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8752,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8753 ierr = KSPGetConvergedReason(check_ksp,&reason);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8753,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8754 ierr = KSPComputeExtremeSingularValues(check_ksp,&lambda_max_s,&lambda_min_s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8754,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8755 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),8755,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8756 for (i=0;i<neigs;i++) {
8757 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),8757,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8758 }
8759 }
8760 ierr = PetscViewerFlush(dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8760,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8761 ierr = PetscViewerASCIISubtractTab(dbg_viewer,2*(pcbddc->current_level+1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8761,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8762 }
8763 ierr = VecDestroy(&check_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8763,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8764 ierr = VecDestroy(&coarse_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8764,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8765 ierr = KSPDestroy(&check_ksp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8765,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8766 if (compute_eigs) {
8767 ierr = PetscFree(eigs_r)((*PetscTrFree)((void*)(eigs_r),8767,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eigs_r) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8767,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8768 ierr = PetscFree(eigs_c)((*PetscTrFree)((void*)(eigs_c),8768,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((eigs_c) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8768,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8769 }
8770 }
8771 }
8772 ierr = MatNullSpaceDestroy(&CoarseNullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8772,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8773 /* print additional info */
8774 if (pcbddc->dbg_flag) {
8775 /* waits until all processes reaches this point */
8776 ierr = PetscBarrier((PetscObject)pc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8776,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8777 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),8777,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8778 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8778,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8779 }
8780
8781 /* free memory */
8782 ierr = MatDestroy(&coarse_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8782,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8783 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),8783,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8784 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
8785}
8786
8787PetscErrorCode PCBDDCComputePrimalNumbering(PC pc,PetscInt* coarse_size_n,PetscInt** local_primal_indices_n)
8788{
8789 PC_BDDC* pcbddc = (PC_BDDC*)pc->data;
8790 PC_IS* pcis = (PC_IS*)pc->data;
8791 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
8792 IS subset,subset_mult,subset_n;
8793 PetscInt local_size,coarse_size=0;
8794 PetscInt *local_primal_indices=NULL((void*)0);
8795 const PetscInt *t_local_primal_indices;
8796 PetscErrorCode ierr;
8797
8798 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8798; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8799 /* Compute global number of coarse dofs */
8800 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),8800,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"BDDC ConstraintsSetUp should be called first"
)
;
8801 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),8801,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8802 ierr = ISLocalToGlobalMappingApplyIS(pcis->mapping,subset_n,&subset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8802,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8803 ierr = ISDestroy(&subset_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8803,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8804 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),8804,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8805 ierr = ISRenumber(subset,subset_mult,&coarse_size,&subset_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8805,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8806 ierr = ISDestroy(&subset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8806,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8807 ierr = ISDestroy(&subset_mult);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8807,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8808 ierr = ISGetLocalSize(subset_n,&local_size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8808,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8809 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),8809,__func__,"/sandbox/petsc/petsc.master/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)
;
8810 ierr = PetscMalloc1(local_size,&local_primal_indices)PetscMallocA(1,PETSC_FALSE,8810,__func__,"/sandbox/petsc/petsc.master/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),8810,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8811 ierr = ISGetIndices(subset_n,&t_local_primal_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8811,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8812 ierr = PetscArraycpy(local_primal_indices,t_local_primal_indices,local_size)((sizeof(*(local_primal_indices)) != sizeof(*(t_local_primal_indices
))) || PetscMemcpy(local_primal_indices,t_local_primal_indices
,(local_size)*sizeof(*(local_primal_indices))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8812,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8813 ierr = ISRestoreIndices(subset_n,&t_local_primal_indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8813,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8814 ierr = ISDestroy(&subset_n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8814,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8815
8816 /* check numbering */
8817 if (pcbddc->dbg_flag) {
8818 PetscScalar coarsesum,*array,*array2;
8819 PetscInt i;
8820 PetscBool set_error = PETSC_FALSE,set_error_reduced = PETSC_FALSE;
8821
8822 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8822,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8823 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"--------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8823,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8824 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Check coarse indices\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8824,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8825 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8825,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8826 /* counter */
8827 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8827,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8828 ierr = VecSet(pcis->vec1_N,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8828,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8829 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),8829,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8830 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),8830,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8831 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),8831,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8832 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),8832,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8833 ierr = VecSet(pcis->vec1_N,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8833,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8834 for (i=0;i<pcbddc->local_primal_size;i++) {
8835 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),8835,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8836 }
8837 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8837,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8838 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8838,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8839 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8839,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8840 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),8840,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8841 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),8841,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8842 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),8842,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8843 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),8843,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8844 ierr = VecGetArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8844,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8845 ierr = VecGetArray(pcis->vec2_N,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8845,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8846 for (i=0;i<pcis->n;i++) {
8847 if (array[i] != 0.0 && array[i] != array2[i]) {
8848 PetscInt owned = (PetscInt)PetscRealPart(array[i])(array[i]),gi;
8849 PetscInt neigh = (PetscInt)PetscRealPart(array2[i])(array2[i]);
8850 set_error = PETSC_TRUE;
8851 ierr = ISLocalToGlobalMappingApply(pcis->mapping,1,&i,&gi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8851,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8852 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),8852,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8853 }
8854 }
8855 ierr = VecRestoreArray(pcis->vec2_N,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8855,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8856 ierr = MPIU_Allreduce(&set_error,&set_error_reduced,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,8856,__func__,"/sandbox/petsc/petsc.master/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),8856,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8857 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8857,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8858 for (i=0;i<pcis->n;i++) {
8859 if (PetscRealPart(array[i])(array[i]) > 0.0) array[i] = 1.0/PetscRealPart(array[i])(array[i]);
8860 }
8861 ierr = VecRestoreArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8861,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8862 ierr = VecSet(pcis->vec1_global,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8862,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8863 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),8863,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8864 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),8864,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8865 ierr = VecSum(pcis->vec1_global,&coarsesum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8865,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8866 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),8866,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8867 if (pcbddc->dbg_flag > 1 || set_error_reduced) {
8868 PetscInt *gidxs;
8869
8870 ierr = PetscMalloc1(pcbddc->local_primal_size,&gidxs)PetscMallocA(1,PETSC_FALSE,8870,__func__,"/sandbox/petsc/petsc.master/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),8870,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8871 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),8871,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8872 ierr = PetscViewerASCIIPrintf(pcbddc->dbg_viewer,"Distribution of local primal indices\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8872,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8873 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8873,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8874 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"Subdomain %04d\n",PetscGlobalRank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8874,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8875 for (i=0;i<pcbddc->local_primal_size;i++) {
8876 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),8876,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8877 }
8878 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8878,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8879 ierr = PetscFree(gidxs)((*PetscTrFree)((void*)(gidxs),8879,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((gidxs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8879,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8880 }
8881 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8881,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8882 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8882,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8883 if (set_error_reduced) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_PLIB,"BDDC Numbering of coarse dofs failed")return PetscError(PetscObjectComm((PetscObject)pc),8883,__func__
,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,77,PETSC_ERROR_INITIAL,"BDDC Numbering of coarse dofs failed"
)
;
8884 }
8885
8886 /* get back data */
8887 *coarse_size_n = coarse_size;
8888 *local_primal_indices_n = local_primal_indices;
8889 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
8890}
8891
8892PetscErrorCode PCBDDCGlobalToLocal(VecScatter g2l_ctx,Vec gwork, Vec lwork, IS globalis, IS* localis)
8893{
8894 IS localis_t;
8895 PetscInt i,lsize,*idxs,n;
8896 PetscScalar *vals;
8897 PetscErrorCode ierr;
8898
8899 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8899; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8900 /* get indices in local ordering exploiting local to global map */
8901 ierr = ISGetLocalSize(globalis,&lsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8901,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8902 ierr = PetscMalloc1(lsize,&vals)PetscMallocA(1,PETSC_FALSE,8902,__func__,"/sandbox/petsc/petsc.master/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),8902,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8903 for (i=0;i<lsize;i++) vals[i] = 1.0;
8904 ierr = ISGetIndices(globalis,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8904,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8905 ierr = VecSet(gwork,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8905,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8906 ierr = VecSet(lwork,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8906,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8907 if (idxs) { /* multilevel guard */
8908 ierr = VecSetOption(gwork,VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8908,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8909 ierr = VecSetValues(gwork,lsize,idxs,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8909,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8910 }
8911 ierr = VecAssemblyBegin(gwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8911,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8912 ierr = ISRestoreIndices(globalis,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8912,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8913 ierr = PetscFree(vals)((*PetscTrFree)((void*)(vals),8913,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((vals) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8913,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8914 ierr = VecAssemblyEnd(gwork);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8914,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8915 /* now compute set in local ordering */
8916 ierr = VecScatterBegin(g2l_ctx,gwork,lwork,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8916,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8917 ierr = VecScatterEnd(g2l_ctx,gwork,lwork,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8917,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8918 ierr = VecGetArrayRead(lwork,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8918,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8919 ierr = VecGetSize(lwork,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8919,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8920 for (i=0,lsize=0;i<n;i++) {
8921 if (PetscRealPart(vals[i])(vals[i]) > 0.5) {
8922 lsize++;
8923 }
8924 }
8925 ierr = PetscMalloc1(lsize,&idxs)PetscMallocA(1,PETSC_FALSE,8925,__func__,"/sandbox/petsc/petsc.master/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),8925,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8926 for (i=0,lsize=0;i<n;i++) {
8927 if (PetscRealPart(vals[i])(vals[i]) > 0.5) {
8928 idxs[lsize++] = i;
8929 }
8930 }
8931 ierr = VecRestoreArrayRead(lwork,(const PetscScalar**)&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8931,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8932 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),8932,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8933 *localis = localis_t;
8934 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
8935}
8936
8937PetscErrorCode PCBDDCSetUpSubSchurs(PC pc)
8938{
8939 PC_IS *pcis=(PC_IS*)pc->data;
8940 PC_BDDC *pcbddc=(PC_BDDC*)pc->data;
8941 PCBDDCSubSchurs sub_schurs=pcbddc->sub_schurs;
8942 Mat S_j;
8943 PetscInt *used_xadj,*used_adjncy;
8944 PetscBool free_used_adj;
8945 PetscErrorCode ierr;
8946
8947 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 8947; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
8948 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),8948,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8949 /* decide the adjacency to be used for determining internal problems for local schur on subsets */
8950 free_used_adj = PETSC_FALSE;
8951 if (pcbddc->sub_schurs_layers == -1) {
8952 used_xadj = NULL((void*)0);
8953 used_adjncy = NULL((void*)0);
8954 } else {
8955 if (pcbddc->sub_schurs_use_useradj && pcbddc->mat_graph->xadj) {
8956 used_xadj = pcbddc->mat_graph->xadj;
8957 used_adjncy = pcbddc->mat_graph->adjncy;
8958 } else if (pcbddc->computed_rowadj) {
8959 used_xadj = pcbddc->mat_graph->xadj;
8960 used_adjncy = pcbddc->mat_graph->adjncy;
8961 } else {
8962 PetscBool flg_row=PETSC_FALSE;
8963 const PetscInt *xadj,*adjncy;
8964 PetscInt nvtxs;
8965
8966 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),8966,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8967 if (flg_row) {
8968 ierr = PetscMalloc2(nvtxs+1,&used_xadj,xadj[nvtxs],&used_adjncy)PetscMallocA(2,PETSC_FALSE,8968,__func__,"/sandbox/petsc/petsc.master/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),8968,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8969 ierr = PetscArraycpy(used_xadj,xadj,nvtxs+1)((sizeof(*(used_xadj)) != sizeof(*(xadj))) || PetscMemcpy(used_xadj
,xadj,(nvtxs+1)*sizeof(*(used_xadj))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8969,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8970 ierr = PetscArraycpy(used_adjncy,adjncy,xadj[nvtxs])((sizeof(*(used_adjncy)) != sizeof(*(adjncy))) || PetscMemcpy
(used_adjncy,adjncy,(xadj[nvtxs])*sizeof(*(used_adjncy))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8970,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8971 free_used_adj = PETSC_TRUE;
8972 } else {
8973 pcbddc->sub_schurs_layers = -1;
8974 used_xadj = NULL((void*)0);
8975 used_adjncy = NULL((void*)0);
8976 }
8977 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),8977,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8978 }
8979 }
8980
8981 /* setup sub_schurs data */
8982 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),8982,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8983 if (!sub_schurs->schur_explicit) {
8984 /* pcbddc->ksp_D up to date only if not using MatFactor with Schur complement support */
8985 ierr = MatSchurComplementSetKSP(S_j,pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8985,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8986 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),8986,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8987 } else {
8988 Mat change = NULL((void*)0);
8989 Vec scaling = NULL((void*)0);
8990 IS change_primal = NULL((void*)0), iP;
8991 PetscInt benign_n;
8992 PetscBool reuse_solvers = (PetscBool)!pcbddc->use_change_of_basis;
8993 PetscBool isseqaij,need_change = PETSC_FALSE;
8994 PetscBool discrete_harmonic = PETSC_FALSE;
8995
8996 if (!pcbddc->use_vertices && reuse_solvers) {
8997 PetscInt n_vertices;
8998
8999 ierr = ISGetLocalSize(sub_schurs->is_vertices,&n_vertices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),8999,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9000 reuse_solvers = (PetscBool)!n_vertices;
9001 }
9002 ierr = PetscObjectTypeCompare((PetscObject)pcbddc->local_mat,MATSEQAIJ"seqaij",&isseqaij);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9002,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9003 if (!isseqaij) {
9004 Mat_IS* matis = (Mat_IS*)pc->pmat->data;
9005 if (matis->A == pcbddc->local_mat) {
9006 ierr = MatDestroy(&pcbddc->local_mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9006,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9007 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),9007,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9008 } else {
9009 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),9009,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9010 }
9011 }
9012 if (!pcbddc->benign_change_explicit) {
9013 benign_n = pcbddc->benign_n;
9014 } else {
9015 benign_n = 0;
9016 }
9017 /* sub_schurs->change is a local object; instead, PCBDDCConstraintsSetUp and the quantities used in the test below are logically collective on pc.
9018 We need a global reduction to avoid possible deadlocks.
9019 We assume that sub_schurs->change is created once, and then reused for different solves, unless the topography has been recomputed */
9020 if (pcbddc->adaptive_userdefined || (pcbddc->deluxe_zerorows && !pcbddc->use_change_of_basis)) {
9021 PetscBool have_loc_change = (PetscBool)(!!sub_schurs->change);
9022 ierr = MPIU_Allreduce(&have_loc_change,&need_change,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)pc))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)pc),
1,9022,__func__,"/sandbox/petsc/petsc.master/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),9022,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9023 need_change = (PetscBool)(!need_change);
9024 }
9025 /* If the user defines additional constraints, we import them here.
9026 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 */
9027 if (need_change) {
9028 PC_IS *pcisf;
9029 PC_BDDC *pcbddcf;
9030 PC pcf;
9031
9032 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),9032,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,56,PETSC_ERROR_INITIAL,"Cannot compute change of basis with a different graph"
)
;
9033 ierr = PCCreate(PetscObjectComm((PetscObject)pc),&pcf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9033,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9034 ierr = PCSetOperators(pcf,pc->mat,pc->pmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9034,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9035 ierr = PCSetType(pcf,PCBDDC"bddc");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9035,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9036
9037 /* hacks */
9038 pcisf = (PC_IS*)pcf->data;
9039 pcisf->is_B_local = pcis->is_B_local;
9040 pcisf->vec1_N = pcis->vec1_N;
9041 pcisf->BtoNmap = pcis->BtoNmap;
9042 pcisf->n = pcis->n;
9043 pcisf->n_B = pcis->n_B;
9044 pcbddcf = (PC_BDDC*)pcf->data;
9045 ierr = PetscFree(pcbddcf->mat_graph)((*PetscTrFree)((void*)(pcbddcf->mat_graph),9045,__func__,
"/sandbox/petsc/petsc.master/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),9045,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9046 pcbddcf->mat_graph = pcbddc->mat_graph;
9047 pcbddcf->use_faces = PETSC_TRUE;
9048 pcbddcf->use_change_of_basis = PETSC_TRUE;
9049 pcbddcf->use_change_on_faces = PETSC_TRUE;
9050 pcbddcf->use_qr_single = PETSC_TRUE;
9051 pcbddcf->fake_change = PETSC_TRUE;
9052
9053 /* setup constraints so that we can get information on primal vertices and change of basis (in local numbering) */
9054 ierr = PCBDDCConstraintsSetUp(pcf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9054,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9055 sub_schurs->change_with_qr = pcbddcf->use_qr_single;
9056 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),9056,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9057 change = pcbddcf->ConstraintMatrix;
9058 pcbddcf->ConstraintMatrix = NULL((void*)0);
9059
9060 /* free unneeded memory allocated in PCBDDCConstraintsSetUp */
9061 ierr = PetscFree(pcbddcf->sub_schurs)((*PetscTrFree)((void*)(pcbddcf->sub_schurs),9061,__func__
,"/sandbox/petsc/petsc.master/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),9061,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9062 ierr = MatNullSpaceDestroy(&pcbddcf->onearnullspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9062,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9063 ierr = PetscFree2(pcbddcf->local_primal_ref_node,pcbddcf->local_primal_ref_mult)PetscFreeA(2,9063,__func__,"/sandbox/petsc/petsc.master/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),9063,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9064 ierr = PetscFree(pcbddcf->primal_indices_local_idxs)((*PetscTrFree)((void*)(pcbddcf->primal_indices_local_idxs
),9064,__func__,"/sandbox/petsc/petsc.master/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),9064,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9065 ierr = PetscFree(pcbddcf->onearnullvecs_state)((*PetscTrFree)((void*)(pcbddcf->onearnullvecs_state),9065
,__func__,"/sandbox/petsc/petsc.master/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),9065,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9066 ierr = PetscFree(pcf->data)((*PetscTrFree)((void*)(pcf->data),9066,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((pcf->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9066,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9067 pcf->ops->destroy = NULL((void*)0);
9068 pcf->ops->reset = NULL((void*)0);
9069 ierr = PCDestroy(&pcf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9069,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9070 }
9071 if (!pcbddc->use_deluxe_scaling) scaling = pcis->D;
9072
9073 ierr = PetscObjectQuery((PetscObject)pc,"__KSPFETIDP_iP",(PetscObject*)&iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9073,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9074 if (iP) {
9075 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),9075,__func__,"/sandbox/petsc/petsc.master/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),9075,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9076 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),9076,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9077 ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if (
__builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9077,__func__,"/sandbox/petsc/petsc.master/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),9077,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9078 }
9079 if (discrete_harmonic) {
9080 Mat A;
9081 ierr = MatDuplicate(pcbddc->local_mat,MAT_COPY_VALUES,&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9081,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9082 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),9082,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9083 ierr = PetscObjectCompose((PetscObject)A,"__KSPFETIDP_iP",(PetscObject)iP);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9083,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9084 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),9084,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9085 ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9085,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9086 } else {
9087 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),9087,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9088 }
9089 ierr = MatDestroy(&change);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9089,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9090 ierr = ISDestroy(&change_primal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9090,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9091 }
9092 ierr = MatDestroy(&S_j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9092,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9093
9094 /* free adjacency */
9095 if (free_used_adj) {
9096 ierr = PetscFree2(used_xadj,used_adjncy)PetscFreeA(2,9096,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,&(used_xadj),&(used_adjncy))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9096,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9097 }
9098 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),9098,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9099 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9100}
9101
9102PetscErrorCode PCBDDCInitSubSchurs(PC pc)
9103{
9104 PC_IS *pcis=(PC_IS*)pc->data;
9105 PC_BDDC *pcbddc=(PC_BDDC*)pc->data;
9106 PCBDDCGraph graph;
9107 PetscErrorCode ierr;
9108
9109 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 9109; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
9110 /* attach interface graph for determining subsets */
9111 if (pcbddc->sub_schurs_rebuild) { /* in case rebuild has been requested, it uses a graph generated only by the neighbouring information */
9112 IS verticesIS,verticescomm;
9113 PetscInt vsize,*idxs;
9114
9115 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),9115,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9116 ierr = ISGetSize(verticesIS,&vsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9116,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9117 ierr = ISGetIndices(verticesIS,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9117,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9118 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)pc),vsize,idxs,PETSC_COPY_VALUES,&verticescomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9118,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9119 ierr = ISRestoreIndices(verticesIS,(const PetscInt**)&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9119,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9120 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),9120,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9121 ierr = PCBDDCGraphCreate(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9121,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9122 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),9122,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9123 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),9123,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9124 ierr = ISDestroy(&verticescomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9124,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9125 ierr = PCBDDCGraphComputeConnectedComponents(graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9125,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9126 } else {
9127 graph = pcbddc->mat_graph;
9128 }
9129 /* print some info */
9130 if (pcbddc->dbg_flag && !pcbddc->sub_schurs_rebuild) {
9131 IS vertices;
9132 PetscInt nv,nedges,nfaces;
9133 ierr = PCBDDCGraphASCIIView(graph,pcbddc->dbg_flag,pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9133,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9134 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),9134,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9135 ierr = ISGetSize(vertices,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9135,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9136 ierr = PetscViewerASCIIPushSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9136,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9137 ierr = PetscViewerASCIISynchronizedPrintf(pcbddc->dbg_viewer,"--------------------------------------------------------------\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9137,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9138 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),9138,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9139 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),9139,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9140 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),9140,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9141 ierr = PetscViewerFlush(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9141,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9142 ierr = PetscViewerASCIIPopSynchronized(pcbddc->dbg_viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9142,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9143 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),9143,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9144 }
9145
9146 /* sub_schurs init */
9147 if (!pcbddc->sub_schurs) {
9148 ierr = PCBDDCSubSchursCreate(&pcbddc->sub_schurs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9148,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9149 }
9150 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),9150,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9151
9152 /* free graph struct */
9153 if (pcbddc->sub_schurs_rebuild) {
9154 ierr = PCBDDCGraphDestroy(&graph);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9154,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9155 }
9156 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9157}
9158
9159PetscErrorCode PCBDDCCheckOperator(PC pc)
9160{
9161 PC_IS *pcis=(PC_IS*)pc->data;
9162 PC_BDDC *pcbddc=(PC_BDDC*)pc->data;
9163 PetscErrorCode ierr;
9164
9165 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 9165; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
9166 if (pcbddc->n_vertices == pcbddc->local_primal_size) {
9167 IS zerodiag = NULL((void*)0);
9168 Mat S_j,B0_B=NULL((void*)0);
9169 Vec dummy_vec=NULL((void*)0),vec_check_B,vec_scale_P;
9170 PetscScalar *p0_check,*array,*array2;
9171 PetscReal norm;
9172 PetscInt i;
9173
9174 /* B0 and B0_B */
9175 if (zerodiag) {
9176 IS dummy;
9177
9178 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),9178,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9179 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),9179,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9180 ierr = MatCreateVecs(B0_B,NULL((void*)0),&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9180,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9181 ierr = ISDestroy(&dummy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9181,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9182 }
9183 /* I need a primal vector to scale primal nodes since BDDC sums contibutions */
9184 ierr = VecDuplicate(pcbddc->vec1_P,&vec_scale_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9184,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9185 ierr = VecSet(pcbddc->vec1_P,1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9185,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9186 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),9186,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9187 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),9187,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9188 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),9188,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9189 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),9189,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9190 ierr = VecReciprocal(vec_scale_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9190,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9191 /* S_j */
9192 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),9192,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9193 ierr = MatSchurComplementSetKSP(S_j,pcbddc->ksp_D);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9193,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9194
9195 /* mimic vector in \widetilde{W}_\Gamma */
9196 ierr = VecSetRandom(pcis->vec1_N,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9196,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9197 /* continuous in primal space */
9198 ierr = VecSetRandom(pcbddc->coarse_vec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9198,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9199 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),9199,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9200 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),9200,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9201 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9201,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9202 ierr = PetscCalloc1(pcbddc->benign_n,&p0_check)PetscMallocA(1,PETSC_TRUE,9202,__func__,"/sandbox/petsc/petsc.master/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),9202,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9203 for (i=0;i<pcbddc->benign_n;i++) p0_check[i] = array[pcbddc->local_primal_size-pcbddc->benign_n+i];
9204 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),9204,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9205 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9205,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9206 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9206,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9207 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9207,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9208 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),9208,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9209 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),9209,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9210 ierr = VecDuplicate(pcis->vec2_B,&vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9210,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9211 ierr = VecCopy(pcis->vec2_B,vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9211,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9212
9213 /* assemble rhs for coarse problem */
9214 /* widetilde{S}_\Gamma w_\Gamma + \widetilde{B0}^T_B p0 */
9215 /* local with Schur */
9216 ierr = MatMult(S_j,pcis->vec2_B,pcis->vec1_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9216,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9217 if (zerodiag) {
9218 ierr = VecGetArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9218,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9219 for (i=0;i<pcbddc->benign_n;i++) array[i] = p0_check[i];
9220 ierr = VecRestoreArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9220,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9221 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),9221,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9222 }
9223 /* sum on primal nodes the local contributions */
9224 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),9224,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9225 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),9225,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9226 ierr = VecGetArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9226,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9227 ierr = VecGetArray(pcbddc->vec1_P,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9227,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9228 for (i=0;i<pcbddc->local_primal_size;i++) array2[i] = array[pcbddc->local_primal_ref_node[i]];
9229 ierr = VecRestoreArray(pcbddc->vec1_P,&array2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9229,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9230 ierr = VecRestoreArray(pcis->vec1_N,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9230,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9231 ierr = VecSet(pcbddc->coarse_vec,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9231,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9232 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),9232,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9233 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),9233,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9234 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),9234,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9235 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),9235,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9236 ierr = VecGetArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9236,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9237 /* scale primal nodes (BDDC sums contibutions) */
9238 ierr = VecPointwiseMult(pcbddc->vec1_P,vec_scale_P,pcbddc->vec1_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9238,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9239 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),9239,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9240 ierr = VecRestoreArray(pcbddc->vec1_P,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9240,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9241 ierr = VecAssemblyBegin(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9241,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9242 ierr = VecAssemblyEnd(pcis->vec1_N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9242,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9243 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),9243,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9244 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),9244,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9245 /* global: \widetilde{B0}_B w_\Gamma */
9246 if (zerodiag) {
9247 ierr = MatMult(B0_B,pcis->vec2_B,dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9247,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9248 ierr = VecGetArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9248,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9249 for (i=0;i<pcbddc->benign_n;i++) pcbddc->benign_p0[i] = array[i];
9250 ierr = VecRestoreArray(dummy_vec,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9250,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9251 }
9252 /* BDDC */
9253 ierr = VecSet(pcis->vec1_D,0.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9253,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9254 ierr = PCBDDCApplyInterfacePreconditioner(pc,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9254,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9255
9256 ierr = VecCopy(pcis->vec1_B,pcis->vec2_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9256,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9257 ierr = VecAXPY(pcis->vec1_B,-1.0,vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9257,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9258 ierr = VecNorm(pcis->vec1_B,NORM_INFINITY,&norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9258,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9259 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),9259,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9260 for (i=0;i<pcbddc->benign_n;i++) {
9261 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])fabs(pcbddc->benign_p0[i]-p0_check[i]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9261,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9262 }
9263 ierr = PetscFree(p0_check)((*PetscTrFree)((void*)(p0_check),9263,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
) || ((p0_check) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9263,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9264 ierr = VecDestroy(&vec_scale_P);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9264,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9265 ierr = VecDestroy(&vec_check_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9265,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9266 ierr = VecDestroy(&dummy_vec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9266,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9267 ierr = MatDestroy(&S_j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9267,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9268 ierr = MatDestroy(&B0_B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9268,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9269 }
9270 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9271}
9272
9273#include <../src/mat/impls/aij/mpi/mpiaij.h>
9274PetscErrorCode MatMPIAIJRestrict(Mat A, MPI_Comm ccomm, Mat *B)
9275{
9276 Mat At;
9277 IS rows;
9278 PetscInt rst,ren;
9279 PetscErrorCode ierr;
9280 PetscLayout rmap;
9281
9282 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
; petscstack->line[petscstack->currentsize] = 9282; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
9283 rst = ren = 0;
9284 if (ccomm != MPI_COMM_NULL((MPI_Comm)0x04000000)) {
9285 ierr = PetscLayoutCreate(ccomm,&rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9285,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9286 ierr = PetscLayoutSetSize(rmap,A->rmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9286,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9287 ierr = PetscLayoutSetBlockSize(rmap,1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9287,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9288 ierr = PetscLayoutSetUp(rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9288,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9289 ierr = PetscLayoutGetRange(rmap,&rst,&ren);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9289,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9290 }
9291 ierr = ISCreateStride(PetscObjectComm((PetscObject)A),ren-rst,rst,1,&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9291,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9292 ierr = MatCreateSubMatrix(A,rows,NULL((void*)0),MAT_INITIAL_MATRIX,&At);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9292,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9293 ierr = ISDestroy(&rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9293,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9294
9295 if (ccomm != MPI_COMM_NULL((MPI_Comm)0x04000000)) {
9296 Mat_MPIAIJ *a,*b;
9297 IS from,to;
9298 Vec gvec;
9299 PetscInt lsize;
9300
9301 ierr = MatCreate(ccomm,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9301,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9302 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),9302,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9303 ierr = MatSetType(*B,MATAIJ"aij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9303,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9304 ierr = PetscLayoutDestroy(&((*B)->rmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9304,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9305 ierr = PetscLayoutSetUp((*B)->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9305,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9306 a = (Mat_MPIAIJ*)At->data;
9307 b = (Mat_MPIAIJ*)(*B)->data;
9308 ierr = MPI_Comm_size(ccomm,&b->size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9308,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9309 ierr = MPI_Comm_rank(ccomm,&b->rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9309,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9310 ierr = PetscObjectReference((PetscObject)a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9310,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9311 ierr = PetscObjectReference((PetscObject)a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9311,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9312 b->A = a->A;
9313 b->B = a->B;
9314
9315 b->donotstash = a->donotstash;
9316 b->roworiented = a->roworiented;
9317 b->rowindices = 0;
9318 b->rowvalues = 0;
9319 b->getrowactive = PETSC_FALSE;
9320
9321 (*B)->rmap = rmap;
9322 (*B)->factortype = A->factortype;
9323 (*B)->assembled = PETSC_TRUE;
9324 (*B)->insertmode = NOT_SET_VALUES;
9325 (*B)->preallocated = PETSC_TRUE;
9326
9327 if (a->colmap) {
9328#if defined(PETSC_USE_CTABLE1)
9329 ierr = PetscTableCreateCopy(a->colmap,&b->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9329,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9330#else
9331 ierr = PetscMalloc1(At->cmap->N,&b->colmap)PetscMallocA(1,PETSC_FALSE,9331,__func__,"/sandbox/petsc/petsc.master/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),9331,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9332 ierr = PetscLogObjectMemory((PetscObject)*B,At->cmap->N*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9332,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9333 ierr = PetscArraycpy(b->colmap,a->colmap,At->cmap->N)((sizeof(*(b->colmap)) != sizeof(*(a->colmap))) || PetscMemcpy
(b->colmap,a->colmap,(At->cmap->N)*sizeof(*(b->
colmap))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9333,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9334#endif
9335 } else b->colmap = 0;
9336 if (a->garray) {
9337 PetscInt len;
9338 len = a->B->cmap->n;
9339 ierr = PetscMalloc1(len+1,&b->garray)PetscMallocA(1,PETSC_FALSE,9339,__func__,"/sandbox/petsc/petsc.master/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),9339,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9340 ierr = PetscLogObjectMemory((PetscObject)(*B),len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9340,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9341 if (len) { ierr = PetscArraycpy(b->garray,a->garray,len)((sizeof(*(b->garray)) != sizeof(*(a->garray))) || PetscMemcpy
(b->garray,a->garray,(len)*sizeof(*(b->garray))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9341,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; }
9342 } else b->garray = 0;
9343
9344 ierr = PetscObjectReference((PetscObject)a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9344,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9345 b->lvec = a->lvec;
9346 ierr = PetscLogObjectParent((PetscObject)*B,(PetscObject)b->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9346,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9347
9348 /* cannot use VecScatterCopy */
9349 ierr = VecGetLocalSize(b->lvec,&lsize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9349,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9350 ierr = ISCreateGeneral(ccomm,lsize,b->garray,PETSC_USE_POINTER,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9350,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9351 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),9351,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9352 ierr = MatCreateVecs(*B,&gvec,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9352,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9353 ierr = VecScatterCreate(gvec,from,b->lvec,to,&b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9353,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9354 ierr = PetscLogObjectParent((PetscObject)*B,(PetscObject)b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9354,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9355 ierr = ISDestroy(&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9355,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9356 ierr = ISDestroy(&to);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9356,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9357 ierr = VecDestroy(&gvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9357,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9358 }
9359 ierr = MatDestroy(&At);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),9359,__func__,"/sandbox/petsc/petsc.master/src/ksp/pc/impls/bddc/bddcprivate.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9360 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
9361}