# DMSwarmSetPointCoordinatesCellwise
Insert point coordinates (defined over the reference cell) within each cell 
## Synopsis
```
#include "petscdmswarm.h"   
PETSC_EXTERN PetscErrorCode DMSwarmSetPointCoordinatesCellwise(DM dm, PetscInt npoints, PetscReal xi[])
```
Not collective


## Input parameters

- ***dm -*** the DMSwarm
- ***celldm -*** the cell DM
- ***npoints -*** the number of points to insert in each cell
- ***xi -*** the coordinates (defined in the local coordinate system for each cell) to insert





## Notes
The method will reset any previous defined points within the DMSwarm.
Only supported for DMPLEX. If you are using a DMDA it is recommended to either use
DMSwarmInsertPointsUsingCellDM(), or extract and set the coordinates yourself the following code

```none
PetscReal *coor;
```
```none
DMSwarmGetField(dm,DMSwarmPICField_coor,NULL,NULL,(void**)&coor);
```
```none
// user code to define the coordinates here
```
```none
DMSwarmRestoreField(dm,DMSwarmPICField_coor,NULL,NULL,(void**)&coor);
```


## See Also
 `DMSwarmSetCellDM()`, `DMSwarmInsertPointsUsingCellDM()`

## Level
beginner

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/swarm/swarmpic.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)  
