Actual source code: spartition.c

  1: #include <petscmat.h>
  2: #include <petsc/private/matimpl.h>

  4: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_Current(MatPartitioning);
  5: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_Average(MatPartitioning part);
  6: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_Square(MatPartitioning);
  7: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_Parmetis(MatPartitioning);
  8: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_Hierarchical(MatPartitioning);
  9: #if defined(PETSC_HAVE_CHACO)
 10: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_Chaco(MatPartitioning);
 11: #endif
 12: #if defined(PETSC_HAVE_PARTY)
 13: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_Party(MatPartitioning);
 14: #endif
 15: #if defined(PETSC_HAVE_PTSCOTCH)
 16: PETSC_EXTERN PetscErrorCode MatPartitioningCreate_PTScotch(MatPartitioning);
 17: #endif

 19: #if defined(PETSC_HAVE_PARMETIS)
 20: PETSC_EXTERN PetscErrorCode MatMeshToCellGraph_Parmetis(Mat, PetscInt, Mat *);
 21: #endif
 22: #if defined(PETSC_HAVE_METIS)
 23: PETSC_EXTERN PetscErrorCode MatMeshToCellGraph_Metis(Mat, PetscInt, Mat *);
 24: #endif

 26: /*@C
 27:   MatPartitioningRegisterAll - Registers all of the matrix partitioning routines in PETSc.

 29:   Not Collective

 31:   Level: developer

 33: .seealso: `MatPartitioning`, `MatPartitioningType`, `MatPartitioningRegister()`, `MatPartitioningRegisterDestroy()`
 34: @*/
 35: PetscErrorCode MatPartitioningRegisterAll(void)
 36: {
 37:   PetscFunctionBegin;
 38:   if (MatPartitioningRegisterAllCalled) PetscFunctionReturn(PETSC_SUCCESS);
 39:   MatPartitioningRegisterAllCalled = PETSC_TRUE;

 41:   PetscCall(MatPartitioningRegister(MATPARTITIONINGCURRENT, MatPartitioningCreate_Current));
 42:   PetscCall(MatPartitioningRegister(MATPARTITIONINGAVERAGE, MatPartitioningCreate_Average));
 43:   PetscCall(MatPartitioningRegister(MATPARTITIONINGSQUARE, MatPartitioningCreate_Square));
 44:   PetscCall(MatPartitioningRegister(MATPARTITIONINGHIERARCH, MatPartitioningCreate_Hierarchical));
 45: #if defined(PETSC_HAVE_PARMETIS)
 46:   PetscCall(MatPartitioningRegister(MATPARTITIONINGPARMETIS, MatPartitioningCreate_Parmetis));
 47: #endif
 48: #if defined(PETSC_HAVE_CHACO)
 49:   PetscCall(MatPartitioningRegister(MATPARTITIONINGCHACO, MatPartitioningCreate_Chaco));
 50: #endif
 51: #if defined(PETSC_HAVE_PARTY)
 52:   PetscCall(MatPartitioningRegister(MATPARTITIONINGPARTY, MatPartitioningCreate_Party));
 53: #endif
 54: #if defined(PETSC_HAVE_PTSCOTCH)
 55:   PetscCall(MatPartitioningRegister(MATPARTITIONINGPTSCOTCH, MatPartitioningCreate_PTScotch));
 56: #endif
 57:   PetscFunctionReturn(PETSC_SUCCESS);
 58: }

 60: /*@C
 61:   MatMeshToCellGraphRegisterAll - Registers all of the mesh-to-cell-graph conversion routines in PETSc.

 63:   Not Collective

 65:   Level: developer

 67: .seealso: `MatMeshToCellGraph()`, `MatMeshToCellGraphRegister()`, `MatMeshToCellGraphType`
 68: @*/
 69: PetscErrorCode MatMeshToCellGraphRegisterAll(void)
 70: {
 71:   PetscFunctionBegin;
 72:   if (MatMeshToCellGraphRegisterAllCalled) PetscFunctionReturn(PETSC_SUCCESS);
 73:   MatMeshToCellGraphRegisterAllCalled = PETSC_TRUE;

 75: #if defined(PETSC_HAVE_PARMETIS)
 76:   PetscCall(MatMeshToCellGraphRegister(MATMESHTOCELLGRAPHPARMETIS, MatMeshToCellGraph_Parmetis));
 77: #endif
 78: #if defined(PETSC_HAVE_METIS)
 79:   PetscCall(MatMeshToCellGraphRegister(MATMESHTOCELLGRAPHMETIS, MatMeshToCellGraph_Metis));
 80: #endif
 81:   PetscFunctionReturn(PETSC_SUCCESS);
 82: }