Actual source code: petscsftypes.h

petsc-3.10.5 2019-03-28
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:   Concepts: star forest

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

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

 19: /*S
 20:    PetscSFNode - specifier of owner and index

 22:    Level: beginner

 24:   Concepts: indexing, stride, distribution

 26:   Sample Usage:
 27: $      PetscSFNode    *remote;
 28: $    PetscMalloc1(nleaves,&remote);
 29: $    for (i=0; i<size; i++) {
 30: $      remote[i].rank = i;
 31: $      remote[i].index = rank;
 32: $    }

 34:   Sample Fortran Usage:
 35: $     type(PetscSFNode) remote(6)
 36: $      remote(1)%rank  = modulo(rank+size-1,size)
 37: $      remote(1)%index = 1 * stride

 39: .seealso: PetscSFSetGraph()
 40: S*/
 41: typedef struct {
 42:   PetscInt rank;                /* Rank of owner */
 43:   PetscInt index;               /* Index of node on rank */
 44: } PetscSFNode;

 46: #endif