Skip to main content
`Ctrl`+`K`

# 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; No Fortran Support

## 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.

## Developer Note

Fortran stub cannot be generated automatically because `message` must be freed with `PetscFree()`

## See Also

`DMLabel`, `DM`, `DMCompareLabels()`, `DMLabelGetNumValues()`, `DMLabelGetDefaultValue()`, `DMLabelGetNonEmptyStratumValuesIS()`, `DMLabelGetStratumIS()`

## Level

intermediate

## Location

src/dm/label/dmlabel.c

## Examples

src/dm/label/tutorials/ex1.c

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