# DMSwarmGetCellSwarm
Extracts a single cell from the DMSwarm object, returns it as a single cell DMSwarm. The cell DM is filtered for fields of that cell, and the filtered DM is used as the cell DM of the new swarm object. 
## Synopsis
```
#include "petscdmswarm.h"   
PETSC_EXTERN PetscErrorCode DMSwarmGetCellSwarm(DM sw, PetscInt cellID, DM cellswarm)
```
Important: Changes to this cell of the swarm will be lost if they are made prior to restoring this cell.

Noncollective


## Input parameters

- ***sw -*** the DMSwarm
- ***cellID -*** the integer id of the cell to be extracted and filtered
- ***cellswarm -*** The DMSwarm to receive the cell





## Notes
This presently only supports DMSWARM_PIC type

Should be restored with DMSwarmRestoreCellSwarm()


## See Also
 `DMSwarmRestoreCellSwarm()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/swarm/swarm.c.html#DMSwarmGetCellSwarm">src/dm/impls/swarm/swarm.c</A>


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


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