Skip to main content
`Ctrl`+`K`

# DMSwarmSetPointCoordinatesCellwise

Insert point coordinates (defined over the reference cell) within each cell

## Synopsis

    #include "petscdmswarm.h"
    PetscErrorCode DMSwarmSetPointCoordinatesCellwise(DM dm, PetscInt npoints, PetscReal xi[])

Not Collective

## Input Parameters

- dm - the `DMSWARM`

- 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

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

## See Also

`DMSWARM`, `DMSwarmSetCellDM()`, `DMSwarmInsertPointsUsingCellDM()`

## Level

beginner

## Location

src/dm/impls/swarm/swarmpic.c

Index of all DMSwarm routines
Table of Contents for all manual pages
Index of all manual pages