Skip to main content
`Ctrl`+`K`

# PetscSFComposeInverse

Compose a new `PetscSF` by putting the inverse of the second `PetscSF` under the first one

## Synopsis

    #include "petscsf.h"
    PetscErrorCode PetscSFComposeInverse(PetscSF sfA, PetscSF sfB, PetscSF *sfBA)

## Input Parameters

- sfA - The first `PetscSF`

- sfB - The second `PetscSF`

## Output Parameter

- sfBA - The composite `PetscSF`.

## Notes

Currently, the two `PetscSF`s must be defined on congruent communicators and they must be true star forests, i.e. the same leaf is not connected with different roots. Even more, all roots of the second `PetscSF` must have a degree of 1, i.e., no roots have more than one leaf connected.

`sfA`’s leaf space and `sfB`’s leaf space might be partially overlapped. The composition builds a graph with `sfA`’s roots and `sfB`’s roots only when there is a path between them. Unconnected roots are not in `sfBA`. Doing a `PetscSFBcastBegin()` and `PetscSFBcastEnd()` on the new `PetscSF` is equivalent to doing a `PetscSFBcastBegin()` and `PetscSFBcastEnd()` on `sfA`, then a `PetscSFReduceBegin()` and `PetscSFReduceEnd()` on `sfB`, on connected roots.

## See Also

PetscSF - an alternative to low-level MPI calls for data communication, `PetscSF`, `PetscSFCompose()`, `PetscSFGetGraph()`, `PetscSFSetGraph()`, `PetscSFCreateInverseSF()`

## Level

developer

## Location

src/vec/is/sf/interface/sf.c

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