:orphan:
# PetscSFCompose
Compose a new `PetscSF` by putting the second `PetscSF` under the first one in a top (roots) down (leaves) view 
## Synopsis
```
#include "petscsf.h" 
PetscErrorCode PetscSFCompose(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.

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


## See Also
 `PetscSF`, `PetscSFComposeInverse()`, `PetscSFGetGraph()`, `PetscSFSetGraph()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/interface/sf.c.html#PetscSFCompose">src/vec/is/sf/interface/sf.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/sf/interface/sf.c)


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