Actual source code: petscsftypes.h

petsc-3.12.5 2020-03-29
Report Typos and Errors
  1: #if !defined(PETSCSFTYPES_H)
  2: #define PETSCSFTYPES_H

  4: /*S
  5:    PetscSF - PETSc object for setting up and managing the communication of certain entries of arrays and Vecs between MPI processes.

  7:    Level: intermediate

  9:        PetscSF uses the concept of star forests to indicate and determine the communication patterns concisely and efficiently.
 10:   A star  https://en.wikipedia.org/wiki/Star_(graph_theory) forest is simply a collection of trees of height 1. The leave nodes represent
 11:   "ghost locations" for the root nodes.

 13: .seealso: PetscSFCreate(), VecScatter, VecScatterCreate()
 14: S*/
 15: typedef struct _p_PetscSF* PetscSF;

 17: /*S
 18:    PetscSFNode - specifier of owner and index

 20:    Level: beginner

 22:   Sample Usage:
 23: $      PetscSFNode    *remote;
 24: $    PetscMalloc1(nleaves,&remote);
 25: $    for (i=0; i<size; i++) {
 26: $      remote[i].rank = i;
 27: $      remote[i].index = rank;
 28: $    }

 30:   Sample Fortran Usage:
 31: $     type(PetscSFNode) remote(6)
 32: $      remote(1)%rank  = modulo(rank+size-1,size)
 33: $      remote(1)%index = 1 * stride

 35: .seealso: PetscSFSetGraph()
 36: S*/
 37: typedef struct {
 38:   PetscInt rank;                /* Rank of owner */
 39:   PetscInt index;               /* Index of node on rank */
 40: } PetscSFNode;

 42: #endif