xref: /petsc/include/petscsftypes.h (revision 20662ed9527f085f2b5d702341a18b0be9deaa22)
16524c165SJacob Faibussowitsch #ifndef PETSCSFTYPES_H
226bd1501SBarry Smith #define PETSCSFTYPES_H
30c312b8eSJed Brown 
4ac09b921SBarry Smith /* SUBMANSEC = PetscSF */
5ac09b921SBarry Smith 
60c312b8eSJed Brown /*S
787497f52SBarry Smith    PetscSF - PETSc object for setting up and managing the communication of certain entries of arrays and `Vec` between MPI ranks.
80c312b8eSJed Brown 
90c312b8eSJed Brown    Level: intermediate
100c312b8eSJed Brown 
1187497f52SBarry Smith        `PetscSF` uses the concept of star forests to indicate and determine the communication patterns concisely and efficiently.
12a8d69d7bSBarry Smith   A star  https://en.wikipedia.org/wiki/Star_(graph_theory) forest is simply a collection of trees of height 1. The leave nodes represent
130c312b8eSJed Brown   "ghost locations" for the root nodes.
140c312b8eSJed Brown 
15db781477SPatrick Sanan .seealso: `PetscSFCreate()`, `VecScatter`, `VecScatterCreate()`
160c312b8eSJed Brown S*/
170c312b8eSJed Brown typedef struct _p_PetscSF *PetscSF;
180c312b8eSJed Brown 
1997929ea7SJunchao Zhang /*J
2087497f52SBarry Smith     PetscSFType - String with the name of a `PetscSF` type
2197929ea7SJunchao Zhang 
2297929ea7SJunchao Zhang    Level: beginner
2397929ea7SJunchao Zhang 
24db781477SPatrick Sanan .seealso: `PetscSFSetType()`, `PetscSF`
2597929ea7SJunchao Zhang J*/
2697929ea7SJunchao Zhang typedef const char *PetscSFType;
27*20662ed9SBarry Smith #define PETSCSFBASIC      "basic"
28*20662ed9SBarry Smith #define PETSCSFNEIGHBOR   "neighbor"
29*20662ed9SBarry Smith #define PETSCSFALLGATHERV "allgatherv"
30*20662ed9SBarry Smith #define PETSCSFALLGATHER  "allgather"
31*20662ed9SBarry Smith #define PETSCSFGATHERV    "gatherv"
32*20662ed9SBarry Smith #define PETSCSFGATHER     "gather"
33*20662ed9SBarry Smith #define PETSCSFALLTOALL   "alltoall"
34*20662ed9SBarry Smith #define PETSCSFWINDOW     "window"
3597929ea7SJunchao Zhang 
36799f573fSMatthew G. Knepley /*S
37799f573fSMatthew G. Knepley    PetscSFNode - specifier of owner and index
38799f573fSMatthew G. Knepley 
39799f573fSMatthew G. Knepley    Level: beginner
40799f573fSMatthew G. Knepley 
4138ab3f8aSBarry Smith   Sample Usage:
4238ab3f8aSBarry Smith $      PetscSFNode    *remote;
439566063dSJacob Faibussowitsch $    PetscCall(PetscMalloc1(nleaves,&remote));
4438ab3f8aSBarry Smith $    for (i=0; i<size; i++) {
4538ab3f8aSBarry Smith $      remote[i].rank = i;
4638ab3f8aSBarry Smith $      remote[i].index = rank;
4738ab3f8aSBarry Smith $    }
4838ab3f8aSBarry Smith 
4938ab3f8aSBarry Smith   Sample Fortran Usage:
5038ab3f8aSBarry Smith $     type(PetscSFNode) remote(6)
5138ab3f8aSBarry Smith $      remote(1)%rank  = modulo(rank+size-1,size)
5238ab3f8aSBarry Smith $      remote(1)%index = 1 * stride
5338ab3f8aSBarry Smith 
54db781477SPatrick Sanan .seealso: `PetscSFSetGraph()`
55799f573fSMatthew G. Knepley S*/
56799f573fSMatthew G. Knepley typedef struct {
57799f573fSMatthew G. Knepley   PetscInt rank;  /* Rank of owner */
58799f573fSMatthew G. Knepley   PetscInt index; /* Index of node on rank */
59799f573fSMatthew G. Knepley } PetscSFNode;
60799f573fSMatthew G. Knepley 
6197929ea7SJunchao Zhang /*S
6297929ea7SJunchao Zhang      VecScatter - Object used to manage communication of data
6397929ea7SJunchao Zhang        between vectors in parallel. Manages both scatters and gathers
6497929ea7SJunchao Zhang 
6597929ea7SJunchao Zhang    Level: beginner
6697929ea7SJunchao Zhang 
6787497f52SBarry Smith .seealso: `Vec`, `PetscSF`, `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()`
6897929ea7SJunchao Zhang S*/
6997929ea7SJunchao Zhang typedef PetscSF VecScatter;
7097929ea7SJunchao Zhang 
7197929ea7SJunchao Zhang /*J
7297929ea7SJunchao Zhang     VecScatterType - String with the name of a PETSc vector scatter type
7397929ea7SJunchao Zhang 
7497929ea7SJunchao Zhang    Level: beginner
7597929ea7SJunchao Zhang 
7687497f52SBarry Smith .seealso: `PetscSFType`, `VecScatterSetType()`, `VecScatter`, `VecScatterCreate()`, `VecScatterDestroy()`
7797929ea7SJunchao Zhang J*/
7897929ea7SJunchao Zhang typedef PetscSFType VecScatterType;
790c312b8eSJed Brown #endif
80