:orphan:
# PCMGSetGalerkin
Causes the coarser grid matrices to be computed from the finest grid via the Galerkin process: A_i-1 = r_i * A_i * p_i 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode PCMGSetGalerkin(PC pc, PCMGGalerkinType use)
```
Logically Collective


## Input Parameters

- ***pc -*** the multigrid context
- ***use -*** one of `PC_MG_GALERKIN_BOTH`, `PC_MG_GALERKIN_PMAT`, `PC_MG_GALERKIN_MAT`, or `PC_MG_GALERKIN_NONE`



## Options Database Key

- ***-pc_mg_galerkin <both,pmat,mat,none> -*** set the matrices to form via the Galerkin process





## Note
Some codes that use `PCMG` such as `PCGAMG` use Galerkin internally while constructing the hierarchy and thus do not
use the `PCMG` construction of the coarser grids.


## See Also
 `PCMG`, `PCMGGetGalerkin()`, `PCMGGalerkinType`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex35.cxx.html">src/ksp/ksp/tutorials/ex35.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex36.cxx.html">src/ksp/ksp/tutorials/ex36.cxx</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex42.c.html">src/ksp/ksp/tutorials/ex42.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex70.c.html">src/ksp/ksp/tutorials/ex70.c</A><BR>

## Implementations

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


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


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