# DMPlexSetAdjacencyUser
Define adjacency in the mesh using a user-provided callback 
## Synopsis
```
#include "petscdmplex.h"   
#include "petscdmlabel.h"  
PetscErrorCode DMPlexSetAdjacencyUser(DM dm, PetscErrorCode (*user)(DM, PetscInt, PetscInt *, PetscInt[], void *), void *ctx)
```

## Input Parameters

- ***dm      -*** The DM object
- ***user    -*** The user callback, may be NULL (to clear the callback)
- ***ctx     -*** context for callback evaluation, may be NULL





## Notes
The caller of DMPlexGetAdjacency may need to arrange that a large enough array is available for the adjacency.

Any setting here overrides other configuration of DMPlex adjacency determination.


## See Also
 `DMSetAdjacency()`, `DMPlexDistribute()`, `DMPlexPreallocateOperator()`, `DMPlexGetAdjacency()`, `DMPlexGetAdjacencyUser()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexdistribute.c.html#DMPlexSetAdjacencyUser">src/dm/impls/plex/plexdistribute.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/plex/plexdistribute.c)


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