PETSc version 3.16.5
Fix/Edit manual page

# DMProjectFunction

This projects the given function into the function space provided, putting the coefficients in a global vector.

### Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMProjectFunction(DM dm, PetscReal time, PetscErrorCode (**funcs)(PetscInt, PetscReal, const PetscReal [], PetscInt, PetscScalar *, void *), void **ctxs, InsertMode mode, Vec X)

Collective on DM

### Input Parameters

| dm | - The DM
| time | - The time
| funcs | - The coordinate functions to evaluate, one per field
| ctxs | - Optional array of contexts to pass to each coordinate function. ctxs itself may be null.
| mode | - The insertion mode for values

### Output Parameter

| X | - vector

### Calling sequence of func

       func(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar u[], void *ctx);

| dim | - The spatial dimension
| time | - The time at which to sample
| x | - The coordinates
| Nc | - The number of components
| u | - The output field values
| ctx | - optional user-defined function context

### See Also

DMProjectFunctionLocal(), DMProjectFunctionLabel(), DMComputeL2Diff()

### Level

developer

### Location

src/dm/interface/dm.c

### Examples

src/snes/tutorials/ex12.c.html
src/snes/tutorials/ex62.c.html
src/snes/tutorials/ex69.c.html
src/snes/tutorials/ex77.c.html
src/ts/tutorials/ex11.c.html
src/ts/tutorials/ex46.c.html
src/ts/tutorials/ex48.c.html
src/tao/tutorials/ex1.c.html
src/tao/tutorials/ex2.c.html
src/tao/tutorials/ex3.c.html
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages