:orphan:
# DMPlexComputeL2DiffVec
This function computes the cellwise L_2 difference between a function u and an FEM interpolant solution u_h, and stores it in a Vec. 
## Synopsis
```
#include "petscdmplex.h"   
PetscErrorCode DMPlexComputeL2DiffVec(DM dm, PetscReal time, PetscErrorCode (**funcs)(PetscInt, PetscReal, const PetscReal[], PetscInt, PetscScalar *, void *), void **ctxs, Vec X, Vec D)
```
Collective


## Input Parameters

- ***dm    -*** The `DM`
- ***time  -*** The time
- ***funcs -*** The functions to evaluate for each field component: `NULL` means that component does not contribute to error calculation
- ***ctxs  -*** Optional array of contexts to pass to each function, or `NULL`.
- ***X     -*** The coefficient vector u_h



## Output Parameter

- ***D -*** A `Vec` which holds the difference ||u - u_h||_2 for each cell





## See Also
 [](ch_unstructured), `DM`, `DMPLEX`, `DMProjectFunction()`, `DMComputeL2Diff()`, `DMPlexComputeL2FieldDiff()`, `DMComputeL2GradientDiff()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexfem.c.html#DMPlexComputeL2DiffVec">src/dm/impls/plex/plexfem.c</A>

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


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


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