PETSc version 3.15.5
Fix/Edit manual page

# DMCreateColoring

Gets coloring for a DM

### Synopsis

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

Collective on dm

### Input Parameter

| dm | - the DM object
| ctype | - IS_COLORING_LOCAL or IS_COLORING_GLOBAL

### Output Parameter

| coloring | - the coloring

### Notes

Coloring of matrices can be computed directly from the sparse matrix nonzero structure via the MatColoring object or from the mesh from which the matrix comes from. 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()

### See Also

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

### Level

developer

### Location

src/dm/interface/dm.c

### Examples

src/snes/tutorials/ex14.c.html
src/tao/unconstrained/tutorials/minsurf2.c.html

### Implementations

DMCreateColoring_Composite in src/dm/impls/composite/pack.c
DMCreateColoring_DA in src/dm/impls/da/fdda.c
DMCreateColoring_Redundant in src/dm/impls/redundant/dmredundant.c
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages