# MatCoarsenRegister
Adds a new sparse matrix coarsening algorithm to the matrix package. 
## Synopsis
```
#include "petscmatcoarsen.h" 
PetscErrorCode MatCoarsenRegister(const char sname[], PetscErrorCode (*function)(MatCoarsen))
```
Logically Collective


## Input Parameters

- ***sname -*** name of coarsen (for example `MATCOARSENMIS`)
- ***function -*** function pointer that creates the coarsen type





## Sample usage
```none
   MatCoarsenRegister("my_agg",MyAggCreate);
```


Then, your aggregator can be chosen with the procedural interface via
```none
MatCoarsenSetType(agg,"my_agg")
```
or at runtime via the option
```none
-mat_coarsen_type my_agg
```


## See Also
 `MatCoarsen`, `MatCoarsenType`, `MatCoarsenSetType()`, `MatCoarsenCreate()`, `MatCoarsenRegisterDestroy()`, `MatCoarsenRegisterAll()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/coarsen/coarsen.c.html#MatCoarsenRegister">src/mat/coarsen/coarsen.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/coarsen/coarsen.c)


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