# petsc4py.PETSc.MatPartitioning

class petsc4py.PETSc.MatPartitioning

  Bases: `Object`

  Object for managing the partitioning of a matrix or graph.

  Enumerations

  `Type` | The partitioning types.

  Methods Summary

  `apply`(partitioning) | Return a partitioning for the graph represented by a sparse matrix.
  `create`([comm]) | Create a partitioning context.
  `destroy`() | Destroy the partitioning context.
  `getType`() | Return the partitioning method.
  `setAdjacency`(adj) | Set the adjacency graph (matrix) of the thing to be partitioned.
  `setFromOptions`() | Set parameters in the partitioner from the options database.
  `setType`(matpartitioning_type) | Set the type of the partitioner to use.
  `view`([viewer]) | View the partitioning data structure.

  Methods Documentation

  apply(partitioning)

    Return a partitioning for the graph represented by a sparse matrix.

    Collective.

    For each local node this tells the processor number that that node is assigned to.

    See also

    `MatPartitioningApply`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:144

    Parameters:

      partitioning (IS)

    Return type:

      None

  create(comm=None)

    Create a partitioning context.

    Collective.

    Parameters:

      comm (Comm | None) – MPI communicator, defaults to `Sys.getDefaultComm`.

    Return type:

      Self

    See also

    `destroy`, `MatPartitioningCreate`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:62

  destroy()

    Destroy the partitioning context.

    Collective.

    See also

    `create`, `MatPartitioningDestroy`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:49

    Return type:

      Self

  getType()

    Return the partitioning method.

    Not collective.

    See also

    `setType`, `MatPartitioningGetType`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:100

    Return type:

      str

  setAdjacency(adj)

    Set the adjacency graph (matrix) of the thing to be partitioned.

    Collective.

    Parameters:

      adj (Mat) – The adjacency matrix, this can be any `Mat.Type` but the natural representation is `Mat.Type.MPIADJ`.

    Return type:

      None

    See also

    `MatPartitioningSetAdjacency`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:126

  setFromOptions()

    Set parameters in the partitioner from the options database.

    Collective.

    See also

    Working with PETSc options, `MatPartitioningSetFromOptions`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:114

    Return type:

      None

  setType(matpartitioning_type)

    Set the type of the partitioner to use.

    Collective.

    Parameters:

      matpartitioning_type (Type | str) – The partitioner type.

    Return type:

      None

    See also

    `getType`, `MatPartitioningSetType`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:81

  view(viewer=None)

    View the partitioning data structure.

    Collective.

    Parameters:

      viewer (Viewer | None) – A `Viewer` to display the graph.

    Return type:

      None

    See also

    `MatPartitioningView`

    Source code at petsc4py/PETSc/MatPartitioning.pyx:29