Actual source code: mpiaijspooles.c
1: #define PETSCMAT_DLL
3: /*
4: Provides an interface to the Spooles parallel sparse solver (MPI SPOOLES)
5: */
8: #include ../src/mat/impls/aij/mpi/mpiaij.h
9: #include ../src/mat/impls/aij/seq/spooles/spooles.h
11: /* Note the Petsc r and c permutations are ignored */
14: PetscErrorCode MatLUFactorSymbolic_MPIAIJSpooles(Mat F,Mat A,IS r,IS c,const MatFactorInfo *info)
15: {
17: if (!info->dtcol) {
18: Mat_Spooles *lu = (Mat_Spooles*) F->spptr;
19: lu->options.pivotingflag = SPOOLES_NO_PIVOTING;
20: }
21: F->ops->lufactornumeric = MatFactorNumeric_MPISpooles;
22: return(0);
23: }
28: PetscErrorCode MatFactorGetSolverPackage_spooles(Mat A,const MatSolverPackage *type)
29: {
31: *type = MAT_SOLVER_SPOOLES;
32: return(0);
33: }
39: PetscErrorCode MatGetFactor_mpiaij_spooles(Mat A,MatFactorType ftype,Mat *F)
40: {
41: Mat_Spooles *lu;
42: Mat B;
46: /* Create the factorization matrix F */
47: MatCreate(((PetscObject)A)->comm,&B);
48: MatSetSizes(B,A->rmap->n,A->cmap->n,A->rmap->N,A->cmap->N);
49: MatSetType(B,((PetscObject)A)->type_name);
50: MatMPIAIJSetPreallocation(B,0,PETSC_NULL,0,PETSC_NULL);
52: PetscNewLog(B,Mat_Spooles,&lu);
53: B->spptr = lu;
54: lu->flg = DIFFERENT_NONZERO_PATTERN;
55: lu->options.useQR = PETSC_FALSE;
57: if (ftype == MAT_FACTOR_LU) {
58: B->ops->lufactorsymbolic = MatLUFactorSymbolic_MPIAIJSpooles;
59: B->ops->view = MatView_Spooles;
60: B->ops->destroy = MatDestroy_MPIAIJSpooles;
61: PetscObjectComposeFunctionDynamic((PetscObject)B,"MatFactorGetSolverPackage_C","MatFactorGetSolverPackage_spooles",MatFactorGetSolverPackage_spooles);
62:
64: lu->options.symflag = SPOOLES_NONSYMMETRIC;
65: lu->options.pivotingflag = SPOOLES_PIVOTING;
66: } else SETERRQ(PETSC_ERR_SUP,"Only LU for AIJ matrices, use SBAIJ for Cholesky");
68: B->factor = ftype;
69: MPI_Comm_dup(((PetscObject)A)->comm,&(lu->comm_spooles));
70: *F = B;
71: return(0);
72: }