:orphan:
# 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)
```
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()`

Changes to this cell of the swarm will be lost if they are made prior to restoring this cell.


## See Also
 `DM`, `DMSWARM`, `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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
