xref: /petsc/include/petscsftypes.h (revision 69f65dfb176f3d3e756fc44d2300fd6791726976)
1 #ifndef PETSCSFTYPES_H
2 #define PETSCSFTYPES_H
3 
4 /* SUBMANSEC = PetscSF */
5 
6 /*S
7    PetscSF - PETSc object for setting up and managing the communication of certain entries of arrays and `Vec` between MPI ranks.
8 
9    Level: intermediate
10 
11        `PetscSF` uses the concept of star forests to indicate and determine the communication patterns concisely and efficiently.
12   A star  https://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 /*J
20     PetscSFType - String with the name of a `PetscSF` type
21 
22    Level: beginner
23 
24 .seealso: `PetscSFSetType()`, `PetscSF`
25 J*/
26 typedef const char *PetscSFType;
27 #define PETSCSFBASIC      "basic"
28 #define PETSCSFNEIGHBOR   "neighbor"
29 #define PETSCSFALLGATHERV "allgatherv"
30 #define PETSCSFALLGATHER  "allgather"
31 #define PETSCSFGATHERV    "gatherv"
32 #define PETSCSFGATHER     "gather"
33 #define PETSCSFALLTOALL   "alltoall"
34 #define PETSCSFWINDOW     "window"
35 
36 /*S
37    PetscSFNode - specifier of owner and index
38 
39    Level: beginner
40 
41   Sample Usage:
42 $      PetscSFNode    *remote;
43 $    PetscCall(PetscMalloc1(nleaves,&remote));
44 $    for (i=0; i<size; i++) {
45 $      remote[i].rank = i;
46 $      remote[i].index = rank;
47 $    }
48 
49   Sample Fortran Usage:
50 $     type(PetscSFNode) remote(6)
51 $      remote(1)%rank  = modulo(rank+size-1,size)
52 $      remote(1)%index = 1 * stride
53 
54 .seealso: `PetscSFSetGraph()`
55 S*/
56 typedef struct {
57   PetscInt rank;  /* Rank of owner */
58   PetscInt index; /* Index of node on rank */
59 } PetscSFNode;
60 
61 /*S
62      VecScatter - Object used to manage communication of data
63        between vectors in parallel. Manages both scatters and gathers
64 
65    Level: beginner
66 
67 .seealso: `Vec`, `PetscSF`, `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()`
68 S*/
69 typedef PetscSF VecScatter;
70 
71 /*J
72     VecScatterType - String with the name of a PETSc vector scatter type
73 
74    Level: beginner
75 
76 .seealso: `PetscSFType`, `VecScatterSetType()`, `VecScatter`, `VecScatterCreate()`, `VecScatterDestroy()`
77 J*/
78 typedef PetscSFType VecScatterType;
79 #endif
80