# DMCreateColoring#

Gets coloring of a graph associated with the DM. Often the graph represents the operator matrix associated with the discretization of a PDE on the DM.

## Synopsis#

#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMCreateColoring(DM dm, ISColoringType ctype, ISColoring *coloring)


Collective on dm

## Input Parameters#

• dm - the DM object

• ctype - IS_COLORING_LOCAL or IS_COLORING_GLOBAL

## Output Parameter#

• coloring - the coloring

## Notes#

Coloring of matrices can also be computed directly from the sparse matrix nonzero structure via the MatColoring object or from the mesh from which the matrix comes from (what this function provides). In general using the mesh produces a more optimal coloring (fewer colors).

This produces a coloring with the distance of 2, see MatSetColoringDistance() which can be used for efficiently computing Jacobians with MatFDColoringCreate()

DMDestroy(), DMView(), DMCreateGlobalVector(), DMCreateInterpolation(), DMCreateMatrix(), DMCreateMassMatrix(), DMSetMatType(), MatColoring, MatFDColoringCreate()

developer

## Location#

src/dm/interface/dm.c

Edit on GitLab