Actual source code: petscpartitioner.h

  1: #pragma once

  3: #include <petscsection.h>

  5: /* SUBMANSEC = MatGraphOperations */

  7: /*S
  8:   PetscPartitioner - PETSc object that manages a graph partitioner

 10:   Level: intermediate

 12:   Note:
 13:   Also consider `MatPartitioning` which provides an alternative API for partitioning.

 15: .seealso: `PetscPartitionerCreate()`, `PetscPartitionerSetType()`, `PetscPartitionerType`, `MatPartitioning`, `MatPartitioningCreate()`
 16: S*/
 17: typedef struct _p_PetscPartitioner *PetscPartitioner;

 19: PETSC_EXTERN PetscClassId   PETSCPARTITIONER_CLASSID;
 20: PETSC_EXTERN PetscErrorCode PetscPartitionerInitializePackage(void);
 21: PETSC_EXTERN PetscErrorCode PetscPartitionerFinalizePackage(void);

 23: /*J
 24:   PetscPartitionerType - String with the name of a PETSc graph partitioner

 26:   Level: beginner

 28: .seealso: `PetscPartitionerSetType()`, `PetscPartitioner`
 29: J*/
 30: typedef const char *PetscPartitionerType;
 31: #define PETSCPARTITIONERPARMETIS "parmetis"
 32: #define PETSCPARTITIONERPTSCOTCH "ptscotch"
 33: #define PETSCPARTITIONERCHACO    "chaco"
 34: #define PETSCPARTITIONERSIMPLE   "simple"
 35: #define PETSCPARTITIONERSHELL    "shell"
 36: #define PETSCPARTITIONERGATHER   "gather"

 38: PETSC_EXTERN PetscFunctionList PetscPartitionerList;
 39: PETSC_EXTERN PetscErrorCode    PetscPartitionerRegister(const char[], PetscErrorCode (*)(PetscPartitioner));

 41: PETSC_EXTERN PetscErrorCode PetscPartitionerCreate(MPI_Comm, PetscPartitioner *);
 42: PETSC_EXTERN PetscErrorCode PetscPartitionerDestroy(PetscPartitioner *);
 43: PETSC_EXTERN PetscErrorCode PetscPartitionerSetType(PetscPartitioner, PetscPartitionerType);
 44: PETSC_EXTERN PetscErrorCode PetscPartitionerGetType(PetscPartitioner, PetscPartitionerType *);
 45: PETSC_EXTERN PetscErrorCode PetscPartitionerSetUp(PetscPartitioner);
 46: PETSC_EXTERN PetscErrorCode PetscPartitionerReset(PetscPartitioner);
 47: PETSC_EXTERN PetscErrorCode PetscPartitionerSetFromOptions(PetscPartitioner);
 48: PETSC_EXTERN PetscErrorCode PetscPartitionerViewFromOptions(PetscPartitioner, PetscObject, const char[]);
 49: PETSC_EXTERN PetscErrorCode PetscPartitionerView(PetscPartitioner, PetscViewer);
 50: PETSC_EXTERN PetscErrorCode PetscPartitionerPartition(PetscPartitioner, PetscInt, PetscInt, PetscInt[], PetscInt[], PetscSection, PetscSection, PetscSection, PetscSection, IS *);

 52: PETSC_EXTERN PetscErrorCode PetscPartitionerShellSetPartition(PetscPartitioner, PetscInt, const PetscInt[], const PetscInt[]);
 53: PETSC_EXTERN PetscErrorCode PetscPartitionerShellSetRandom(PetscPartitioner, PetscBool);
 54: PETSC_EXTERN PetscErrorCode PetscPartitionerShellGetRandom(PetscPartitioner, PetscBool *);

 56: /* We should implement MatPartitioning with PetscPartitioner */
 57: #include <petscmat.h>
 58: #define PETSCPARTITIONERMATPARTITIONING "matpartitioning"
 59: PETSC_EXTERN PetscErrorCode PetscPartitionerMatPartitioningGetMatPartitioning(PetscPartitioner, MatPartitioning *);