Skip to main content
`Ctrl`+`K`

# PetscSFNode

specifier of MPI rank owner and local index for array or `Vec` entry locations that are to be communicated with a `PetscSF`

## Synopsis

    typedef struct {
      PetscInt rank;  /* MPI rank of owner */
      PetscInt index; /* Index of node on rank */
    } PetscSFNode;

## Sample Usage

        PetscSFNode    *remote;
        PetscCall(PetscMalloc1(nleaves,&remote));
        for (i=0; i<size; i++) {
          remote[i].rank = i;
          remote[i].index = rank;
        }

## Sample Fortran Usage

        type(PetscSFNode) remote(6)
        remote(1)%rank  = modulo(rank+size-1,size)
        remote(1)%index = 1 * stride

## Notes

Use `MPIU_SF_NODE` when performing MPI operations on arrays of `PetscSFNode`

Generally the values of `rank` should be in \([ 0,size)\) and the value of `index` greater than or equal to 0, but there are some situations that violate this.

## See Also

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

## Level

beginner

## Location

include/petscsftypes.h

## Examples

src/dm/tutorials/swarm_ex3.c
src/vec/is/sf/tutorials/ex1f.F90
src/vec/is/sf/tutorials/ex3.c
src/vec/is/sf/tutorials/ex1.c
src/vec/is/sf/tutorials/ex2.c

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