Actual source code: clique.cxx

petsc-master 2019-07-20
Report Typos and Errors
  1:  #include <../src/mat/impls/aij/mpi/clique/matcliqueimpl.h>

  3: /*
  4:   MatConvertToSparseElemental: Convert Petsc aij matrix to sparse elemental matrix

  6:   input:
  7: +   A     - matrix in seqaij or mpiaij format
  8: -   reuse - denotes if the destination matrix is to be created or reused. 
  9:             Use MAT_INPLACE_MATRIX for inplace conversion, otherwise use MAT_INITIAL_MATRIX or MAT_REUSE_MATRIX.

 11:   output:
 12: .   cliq - Clique context
 13: */
 14: PetscErrorCode MatConvertToSparseElemental(Mat A,MatReuse reuse,Mat_SparseElemental *cliq)
 15: {
 17:   return(0);
 18: }

 20: PetscErrorCode MatView_SparseElemental(Mat A,PetscViewer viewer)
 21: {
 23:   PetscBool      iascii;

 26:   PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);
 27:   if (iascii) {
 28:     PetscViewerFormat format;
 29:     PetscViewerGetFormat(viewer,&format);
 30:     if (format == PETSC_VIEWER_ASCII_INFO) {
 31:       PetscViewerASCIIPrintf(viewer,"SparseElemental run parameters:\n");
 32:     } else if (format == PETSC_VIEWER_DEFAULT) { /* matrix A is factored matrix, remove this block */
 33:       Mat Aaij;
 34:       PetscViewerASCIIUseTabs(viewer,PETSC_FALSE);
 35:       PetscViewerASCIIUseTabs(viewer,PETSC_TRUE);
 36:       PetscPrintf(PetscObjectComm((PetscObject)viewer),"SparseElemental matrix\n");
 37:       MatComputeOperator(A,MATAIJ,&Aaij);
 38:       MatView(Aaij,viewer);
 39:       MatDestroy(&Aaij);
 40:     }
 41:   }
 42:   return(0);
 43: }

 45: PetscErrorCode MatDestroy_SparseElemental(Mat A)
 46: {

 50:   PetscObjectComposeFunction((PetscObject)A,"MatFactorGetSolverType_C",NULL);
 51:   return(0);
 52: }

 54: PetscErrorCode MatSolve_SparseElemental(Mat A,Vec B,Vec X)
 55: {
 57:   return(0);
 58: }

 60: PetscErrorCode MatCholeskyFactorNumeric_SparseElemental(Mat F,Mat A,const MatFactorInfo *info)
 61: {
 63:   return(0);
 64: }

 66: PetscErrorCode MatCholeskyFactorSymbolic_SparseElemental(Mat F,Mat A,IS r,const MatFactorInfo *info)
 67: {
 69:   return(0);
 70: }

 72: /*MC
 73:      MATSOLVERSPARSEELEMENTAL  - A solver package providing direct solvers for sparse distributed
 74:   and sequential matrices via the external package Elemental

 76:   Use ./configure --download-elemental to have PETSc installed with Elemental

 78:   Use -pc_type lu -pc_factor_mat_solver_type sparseelemental to use this direct solver

 80:   This is currently not supported.

 82:   Developer Note: Jed Brown made the interface for Clique when it was a standalone package. Later Jack Poulson merged and refactored Clique into
 83:   Elemental but since the Clique interface was not tested in PETSc the interface was not updated for the new Elemental interface. Later Barry Smith updated
 84:   all the boilerplate for the Clique interface to SparseElemental but since the solver interface changed dramatically he did not update the code
 85:   that actually calls the SparseElemental solvers. We are waiting on someone who has a need to complete the SparseElemental interface from PETSc.

 87:   Level: beginner

 89: .seealso: PCFactorSetMatSolverType(), MatSolverType

 91: M*/

 93: PetscErrorCode MatFactorGetSolverType_SparseElemental(Mat A,MatSolverType *type)
 94: {
 96:   *type = MATSOLVERSPARSEELEMENTAL;
 97:   return(0);
 98: }

100: extern PetscErrorCode PetscElementalInitializePackage(void);

102: static PetscErrorCode MatGetFactor_aij_sparseelemental(Mat A,MatFactorType ftype,Mat *F)
103: {
105:   return(0);
106: }

108: PETSC_EXTERN PetscErrorCode MatSolverTypeRegister_SparseElemental(void)
109: {

113:   MatSolverTypeRegister(MATSOLVERSPARSEELEMENTAL,MATMPIAIJ,MAT_FACTOR_LU,MatGetFactor_aij_sparseelemental);
114:   return(0);
115: }