Skip to main content
`Ctrl`+`K`

# DMProjectFunctionLabel

This projects the given function into the function space provided by the `DM`, putting the coefficients in a global vector, setting values only for points in the given label.

## Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMProjectFunctionLabel(DM dm, PetscReal time, DMLabel label, PetscInt numIds, const PetscInt ids[], PetscInt Nc, const PetscInt comps[], PetscErrorCode (**funcs)(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nc, PetscScalar *u, PetscCtx ctx), void **ctxs, InsertMode mode, Vec X)

Collective

## Input Parameters

- dm - The `DM`

- time - The time

- numIds - The number of ids

- ids - The ids

- Nc - The number of components

- comps - The components

- label - The `DMLabel` selecting the portion of the mesh for projection

- funcs - The coordinate functions to evaluate, one per field

- ctxs - Optional array of contexts to pass to each coordinate function. ctxs may be null.

- mode - The insertion mode for values

## Output Parameter

- X - vector

## Calling sequence of `funcs`

- dim - The spatial dimension

- time - The current timestep

- x - The coordinates

- Nc - The number of components

- u - The output field values

- ctx - optional function context

## Developer Notes

This API is specific to only particular usage of `DM`

The notes need to provide some information about what has to be provided to the `DM` to be able to perform the computation.

## See Also

DM Basics, `DM`, `DMProjectFunction()`, `DMProjectFunctionLocal()`, `DMProjectFunctionLabelLocal()`, `DMComputeL2Diff()`

## Level

developer

## Location

src/dm/interface/dm.c

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