petsc-3.12.4 2020-02-04
Report Typos and Errors

# PetscSFSetGraph

Set a parallel star forest

### Synopsis

    #include "petscsf.h"
    PetscErrorCode PetscSFSetGraph(PetscSF sf,PetscInt nroots,PetscInt nleaves,const PetscInt *ilocal,PetscCopyMode localmode,const PetscSFNode *iremote,PetscCopyMode remotemode)

Collective

### Input Arguments

| sf | - star forest
| nroots | - number of root vertices on the current process (these are possible targets for other process to attach leaves)
| nleaves | - number of leaf vertices on the current process, each of these references a root on any process
| ilocal | - locations of leaves in leafdata buffers, pass NULL for contiguous storage (locations must be >= 0, enforced during setup in debug mode)
| localmode | - copy mode for ilocal
| iremote | - remote locations of root vertices for each leaf on the current process (locations must be >= 0, enforced during setup in debug mode)
| remotemode | - copy mode for iremote

### Notes

In Fortran you must use PETSC_COPY_VALUES for localmode and remotemode

Developers Note: Local indices which are the identity permutation in the range [0,nleaves) are discarded as they encode contiguous storage. In such case, if localmode is PETSC_OWN_POINTER, the memory is deallocated as it is not needed

Developers Note: This object does not necessarily encode a true star forest in the graph theoretic sense, since leaf indices are not required to be unique. Some functions, however, rely on unique leaf indices (checked in debug mode).

### See Also

PetscSFCreate(), PetscSFView(), PetscSFGetGraph()

### Level

intermediate

### Location

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

### Examples

src/vec/is/sf/examples/tutorials/ex1.c.html
src/vec/is/sf/examples/tutorials/ex2.c.html
src/vec/is/sf/examples/tutorials/ex1f.F90.html
src/dm/examples/tutorials/swarm_ex3.c.html
src/ts/examples/tutorials/ex11.c.html
Index of all PetscSF routines
Table of Contents for all manual pages
Index of all manual pages