# DMProjectFieldLocal
This projects the given function of the input fields into the function space provided by the `DM`, putting the coefficients in a local vector. 
## Synopsis
```
#include "petscdm.h"          
#include "petscdmlabel.h"     
#include "petscds.h"     
PetscErrorCode DMProjectFieldLocal(DM dm, PetscReal time, Vec localU, void (**funcs)(PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], const PetscInt[], const PetscInt[], const PetscScalar[], const PetscScalar[], const PetscScalar[], PetscReal, const PetscReal[], PetscInt, const PetscScalar[], PetscScalar[]), InsertMode mode, Vec localX)
```
Not collective


## Input Parameters

- ***dm      -*** The `DM`
- ***time    -*** The time
- ***localU  -*** The input field vector
- ***funcs   -*** The functions to evaluate, one per field
- ***mode    -*** The insertion mode for values



## Output Parameter

- ***localX  -*** The output vector



## Calling sequence of func
```none
func(PetscInt dim, PetscInt Nf, PetscInt NfAux,
```
```none
const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
```
```none
const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
```
```none
PetscReal t, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f[]);
```


- ***dim          -*** The spatial dimension
- ***Nf           -*** The number of input fields
- ***NfAux        -*** The number of input auxiliary fields
- ***uOff         -*** The offset of each field in u[]
- ***uOff_x       -*** The offset of each field in u_x[]
- ***u            -*** The field values at this point in space
- ***u_t          -*** The field time derivative at this point in space (or NULL)
- ***u_x          -*** The field derivatives at this point in space
- ***aOff         -*** The offset of each auxiliary field in u[]
- ***aOff_x       -*** The offset of each auxiliary field in u_x[]
- ***a            -*** The auxiliary field values at this point in space
- ***a_t          -*** The auxiliary field time derivative at this point in space (or NULL)
- ***a_x          -*** The auxiliary field derivatives at this point in space
- ***t            -*** The current time
- ***x            -*** The coordinates of this point
- ***numConstants -*** The number of constants
- ***constants    -*** The value of each constant
- ***f            -*** The value of the function at this point in space



## Note
There are three different `DM`s that potentially interact in this function. The output `DM`, dm, specifies the layout of the values calculates by funcs.
The input `DM`, attached to U, may be different. For example, you can input the solution over the full domain, but output over a piece of the boundary, or
a subdomain. You can also output a different number of fields than the input, with different discretizations. Last the auxiliary `DM`, attached to the
auxiliary field vector, which is attached to dm, can also be different. It can have a different topology, number of fields, and discretizations.




## 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
 `DMProjectField()`, `DMProjectFieldLabelLocal()`, `DMProjectFunction()`, `DMComputeL2Diff()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/interface/dm.c.html#DMProjectFieldLocal">src/dm/interface/dm.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex12.c.html">src/snes/tutorials/ex12.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/forest/p4est/pforest.h.html#DMProjectFieldLocal_pforest(DM dm, PetscReal time, Vec localU, void (**funcs)">DMProjectFieldLocal_pforest(DM dm, PetscReal time, Vec localU, void (**funcs) in src/dm/impls/forest/p4est/pforest.h</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexproject.c.html#DMProjectFieldLocal_Plex(DM dm, PetscReal time, Vec localU, void (**funcs)">DMProjectFieldLocal_Plex(DM dm, PetscReal time, Vec localU, void (**funcs) in src/dm/impls/plex/plexproject.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/interface/dm.c)


[Index of all DM routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
