Skip to main content
`Ctrl`+`K`

# DMCompareLabels

Compare labels between two `DM` objects

## Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMCompareLabels(DM dm0, DM dm1, PetscBool *equal, char *message[]) PeNS

Collective; No Fortran Support

## Input Parameters

- dm0 - First `DM` object

- dm1 - Second `DM` object

## Output Parameters

- equal - (Optional) Flag whether labels of `dm0` and `dm1` are the same

- message - (Optional) Message describing the difference, or `NULL` if there is no difference

## Notes

The output flag equal will be the same on all processes.

If equal is passed as `NULL` and difference is found, an error is thrown on all processes.

Make sure to pass equal is `NULL` on all processes or none of them.

The output message is set independently on each rank.

message must be freed with `PetscFree()`

If message is passed as `NULL` and a difference is found, the difference description is printed to `stderr` in synchronized manner.

Make sure to pass message as `NULL` on all processes or no processes.

Labels are matched by name. If the number of labels and their names are equal, `DMLabelCompare()` is used to compare each pair of labels with the same name.

## Developer Note

Cannot automatically generate the Fortran stub because `message` must be freed with `PetscFree()`

## See Also

DM Basics, `DM`, `DMLabel`, `DMAddLabel()`, `DMCopyLabelsMode`, `DMLabelCompare()`

## Level

intermediate

## Location

src/dm/interface/dm.c

## Examples

src/dm/label/tutorials/ex1.c

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