Skip to main content
`Ctrl`+`K`

# DMSwarmComputeMoments

Compute the first three particle moments for a given field

## Synopsis

    #include "petscdmswarm.h"
    PetscErrorCode DMSwarmComputeMoments(DM sw, const char coordinate[], const char weight[], PetscReal moments[])

Noncollective

## Input Parameters

- sw - the `DMSWARM`

- coordinate - the coordinate field name

- weight - the weight field name

## Output Parameter

- moments - the field moments

## Notes

The `moments` array should be of length bs + 2, where bs is the block size of the coordinate field.

The weight field must be a scalar, having blocksize 1.

## See Also

`DM`, `DMSWARM`, `DMPlexComputeMoments()`

## Level

intermediate

## Location

src/dm/impls/swarm/swarm.c

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