:orphan:
# PetscSFGetRootRanks
Get root ranks and number of vertices referenced by leaves on this process 
## Synopsis
```
#include "petscsf.h" 
PetscErrorCode PetscSFGetRootRanks(PetscSF sf, PetscInt *nranks, const PetscMPIInt **ranks, const PetscInt **roffset, const PetscInt **rmine, const PetscInt **rremote)
```
Not Collective


## Input Parameter

- ***sf -*** star forest



## Output Parameters

- ***nranks -*** number of ranks referenced by local part
- ***ranks -*** [`nranks`] array of ranks
- ***roffset -*** [`nranks`+1] offset in `rmine`/`rremote` for each rank
- ***rmine -*** [`roffset`[`nranks`]] concatenated array holding local indices referencing each remote rank
- ***rremote -*** [`roffset`[`nranks`]] concatenated array holding remote indices referenced for each remote rank





## See Also
 `PetscSF`, `PetscSFGetLeafRanks()`

## Level
developer

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex1.c.html">src/vec/is/sf/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex1f.F90.html">src/vec/is/sf/tutorials/ex1f.F90</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/impls/basic/allgatherv/sfallgatherv.c.html#PetscSFGetRootRanks_Allgatherv">PetscSFGetRootRanks_Allgatherv in src/vec/is/sf/impls/basic/allgatherv/sfallgatherv.c</A><BR>


---
[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)  
