Date: 2025-03-29T05:58:17+00:00

Actual source code: petscpartitioner.h

      1: #pragma once

      3: #include <petscsection.h>

      5: /* MANSEC = Mat */
      6: /* SUBMANSEC = MatGraphOperations */

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

     11:   Level: intermediate

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

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

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

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

     27:   Level: beginner

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

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

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

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

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