Skip to main content
`Ctrl`+`K`

# PetscSFCreateFromLayouts

Creates a parallel star forest mapping between two `PetscLayout` objects

## Synopsis

    #include "petscsf.h"
    PetscErrorCode PetscSFCreateFromLayouts(PetscLayout rmap, PetscLayout lmap, PetscSF *sf)

Collective

## Input Parameters

- rmap - `PetscLayout` defining the global root space

- lmap - `PetscLayout` defining the global leaf space

## Output Parameter

- sf - The parallel star forest

## Notes

If the global length of `lmap` differs from the global length of `rmap` then the excess entries are ignored.

The resulting `sf` used with `PetscSFBcastBegin()` and `PetscSFBcastEnd()` merely copies the array entries of `rootdata` to `leafdata`; moving them between MPI processes if needed. For example, if rmap is [0, 3, 5) and lmap is [0, 2, 6) and `rootdata` is (1, 2, 3) on MPI rank 0 and (4, 5) on MPI rank 1 then the `leafdata` would become (1, 2) on MPI rank 0 and (3, 4, 5, x) on MPI rank 1.

## See Also

PetscSF - an alternative to low-level MPI calls for data communication, `PetscSF`, `PetscLayout`, `PetscSFCreate()`, `PetscSFSetGraph()`, `PetscLayoutCreate()`, `PetscSFSetGraphLayout()`

## Level

intermediate

## Location

src/vec/is/sf/utils/sfutils.c

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