xref: /petsc/include/petscsftypes.h (revision feff33ee0b5b037fa8f9f294dede656a2f85cc47)
1 #if !defined(_PETSCSFTYPES_H)
2 #define _PETSCSFTYPES_H
3 
4 /*S
5    PetscSF - PETSc object for setting up and managing the communication of certain entries of arrays and Vecs between MPI processes.
6 
7    Level: intermediate
8 
9   Concepts: star forest
10 
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.
14 
15 .seealso: PetscSFCreate(), VecScatter, VecScatterCreate()
16 S*/
17 typedef struct _p_PetscSF* PetscSF;
18 
19 /*S
20    PetscSFNode - specifier of owner and index
21 
22    Level: beginner
23 
24   Concepts: indexing, stride, distribution
25 
26   Sample Usage:
27 $      PetscSFNode    *remote;
28 $    ierr = PetscMalloc1(nleaves,&remote);CHKERRQ(ierr);
29 $    for (i=0; i<size; i++) {
30 $      remote[i].rank = i;
31 $      remote[i].index = rank;
32 $    }
33 
34   Sample Fortran Usage:
35 $     type(PetscSFNode) remote(6)
36 $      remote(1)%rank  = modulo(rank+size-1,size)
37 $      remote(1)%index = 1 * stride
38 
39 .seealso: PetscSFSetGraph()
40 S*/
41 typedef struct {
42   PetscInt rank;                /* Rank of owner */
43   PetscInt index;               /* Index of node on rank */
44 } PetscSFNode;
45 
46 #endif
47