DMSwarmSetPointsUniformCoordinates — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# DMSwarmSetPointsUniformCoordinates

Set point coordinates in a `DMSWARM` on a regular (ijk) grid

## Synopsis

    #include "petscdmswarm.h"
    PETSC_EXTERN PetscErrorCode DMSwarmSetPointsUniformCoordinates(DM dm, PetscReal min[], PetscReal max[], PetscInt npoints[], InsertMode mode)

Collective

## Input Parameters

- dm - the `DMSWARM`

- min - minimum coordinate values in the x, y, z directions (array of length dim)

- max - maximum coordinate values in the x, y, z directions (array of length dim)

- npoints - number of points in each spatial direction (array of length dim)

- mode - indicates whether to append points to the swarm (`ADD_VALUES`), or over-ride existing points (`INSERT_VALUES`)

## Notes

When using mode = `INSERT_VALUES`, this method will reset the number of particles in the `DMSWARM` to be `npoints[0]` x `npoints[1]` (2D) or `npoints[0]` x `npoints[1]` x `npoints[2]` (3D). When using mode = `ADD_VALUES`, new points will be appended to any already existing in the `DMSWARM`

## See Also

`DM`, `DMSWARM`, `DMSwarmSetType()`, `DMSwarmSetCellDM()`, `DMSwarmType`

## Level

beginner

## Location

src/dm/impls/swarm/swarmpic.c

## Examples

src/dm/tutorials/ex21.c
src/ksp/ksp/tutorials/ex70.c
src/dm/tutorials/ex20.c

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