# PCBDDCSetDiscreteGradient
Sets the discrete gradient 
## Synopsis
```
#include "petscpc.h" 
PetscErrorCode PCBDDCSetDiscreteGradient(PC pc, Mat G, PetscInt order, PetscInt field, PetscBool global, PetscBool conforming)
```
Collective


## Input Parameters

- ***pc         -*** the preconditioning context
- ***G          -*** the discrete gradient matrix (in `MATAIJ` format)
- ***order      -*** the order of the Nedelec space (1 for the lowest order)
- ***field      -*** the field id of the Nedelec dofs (not used if the fields have not been specified)
- ***global     -*** the type of global ordering for the rows of G
- ***conforming -*** whether the mesh is conforming or not





## Note
The discrete gradient matrix G is used to analyze the subdomain edges, and it should not contain any zero entry.
For variable order spaces, the order should be set to zero.
If global is true, the rows of G should be given in global ordering for the whole dofs;
if false, the ordering should be global for the Nedelec field.
In the latter case, it should hold gid[i] < gid[j] iff geid[i] < geid[j], with gid the global orderding for all the dofs
and geid the one for the Nedelec field.


## See Also
 `PCBDDC`, `PCBDDCSetDofsSplitting()`, `PCBDDCSetDofsSplittingLocal()`, `MATAIJ`, `PCBDDCSetDivergenceMat()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/bddc/bddc.c.html#PCBDDCSetDiscreteGradient">src/ksp/pc/impls/bddc/bddc.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/bddc/bddc.c.html#PCBDDCSetDiscreteGradient_BDDC">PCBDDCSetDiscreteGradient_BDDC in src/ksp/pc/impls/bddc/bddc.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/bddc/bddc.c)


[Index of all PC routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
