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: {
 16:   Mat_Spooles    *lu;

 19:   if (!info->dtcol) {
 20:     lu = (Mat_Spooles*) F->spptr;
 21:     lu->options.pivotingflag  = SPOOLES_NO_PIVOTING;
 22:   }
 23:   F->ops->lufactornumeric  = MatFactorNumeric_MPISpooles;
 24:   F->ops->solve            = MatSolve_MPISpooles;
 25:   return(0);
 26: }

 31: PetscErrorCode MatFactorGetSolverPackage_spooles(Mat A,const MatSolverPackage *type)
 32: {
 34:   *type = MAT_SOLVER_SPOOLES;
 35:   return(0);
 36: }

 42: PetscErrorCode MatGetFactor_mpiaij_spooles(Mat A,MatFactorType ftype,Mat *F)
 43: {
 44:   Mat_Spooles    *lu;
 45:   Mat            B;


 50:   /* Create the factorization matrix F */
 51:   MatCreate(((PetscObject)A)->comm,&B);
 52:   MatSetSizes(B,A->rmap->n,A->cmap->n,A->rmap->N,A->cmap->N);
 53:   MatSetType(B,((PetscObject)A)->type_name);
 54:   MatMPIAIJSetPreallocation(B,0,PETSC_NULL,0,PETSC_NULL);

 56:   PetscNewLog(B,Mat_Spooles,&lu);
 57:   B->spptr          = lu;
 58:   lu->flg           = DIFFERENT_NONZERO_PATTERN;
 59:   lu->options.useQR = PETSC_FALSE;

 61:   if (ftype == MAT_FACTOR_LU) {
 62:     B->ops->lufactorsymbolic = MatLUFactorSymbolic_MPIAIJSpooles;
 63:     B->ops->view             = MatView_Spooles;
 64:     B->ops->destroy          = MatDestroy_MPIAIJSpooles;
 65:     PetscObjectComposeFunctionDynamic((PetscObject)B,"MatFactorGetSolverPackage_C","MatFactorGetSolverPackage_spooles",MatFactorGetSolverPackage_spooles);
 66:     B->factor                = MAT_FACTOR_LU;

 68:     lu->options.symflag      = SPOOLES_NONSYMMETRIC;
 69:     lu->options.pivotingflag = SPOOLES_PIVOTING;
 70:   } else SETERRQ(PETSC_ERR_SUP,"Only LU for AIJ matrices, use SBAIJ for Cholesky");
 71:   B->factor = ftype;
 72:   MPI_Comm_dup(((PetscObject)A)->comm,&(lu->comm_spooles));

 74:   *F = B;
 75:   return(0);
 76: }