# DMLabelCompare
Compare two DMLabel objects 
## Synopsis
```
#include "petscdmlabel.h"   
#include "petscsection.h"   
PetscErrorCode DMLabelCompare(MPI_Comm comm, DMLabel l0, DMLabel l1, PetscBool *equal, char **message)
```
Collective on comm


## Input Parameters

- ***comm -*** Comm over which to compare labels
- ***l0 -*** First DMLabel
- ***l1 -*** Second DMLabel


Output Parameters

- ***equal   -*** (Optional) Flag whether the two labels are equal
- ***message -*** (Optional) Message describing the difference





## Notes
The output flag equal is the same on all processes.
If it is passed as NULL and difference is found, an error is thrown on all processes.
Make sure to pass NULL on all processes.

The output message is set independently on each rank.
It is set to NULL if no difference was found on the current rank. It must be freed by user.
If message is passed as NULL and difference is found, the difference description is printed to stderr in synchronized manner.
Make sure to pass NULL on all processes.

For the comparison, we ignore the order of stratum values, and strata with no points.

The communicator needs to be specified because currently DMLabel can live on PETSC_COMM_SELF even if the underlying DM is parallel.


## Fortran Notes
This function is currently not available from Fortran.


## See Also
 `DMCompareLabels()`, `DMLabelGetNumValues()`, `DMLabelGetDefaultValue()`, `DMLabelGetNonEmptyStratumValuesIS()`, `DMLabelGetStratumIS()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/label/dmlabel.c.html#DMLabelCompare">src/dm/label/dmlabel.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/label/tutorials/ex1.c.html">src/dm/label/tutorials/ex1.c.html</A><BR>


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


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