xref: /petsc/include/petscsftypes.h (revision db7814771ca77b190574494e87b584e981451db0)
126bd1501SBarry Smith #if !defined(PETSCSFTYPES_H)
226bd1501SBarry Smith #define PETSCSFTYPES_H
30c312b8eSJed Brown 
40c312b8eSJed Brown /*S
50c312b8eSJed Brown    PetscSF - PETSc object for setting up and managing the communication of certain entries of arrays and Vecs between MPI processes.
60c312b8eSJed Brown 
70c312b8eSJed Brown    Level: intermediate
80c312b8eSJed Brown 
90c312b8eSJed Brown        PetscSF uses the concept of star forests to indicate and determine the communication patterns concisely and efficiently.
10a8d69d7bSBarry 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
110c312b8eSJed Brown   "ghost locations" for the root nodes.
120c312b8eSJed Brown 
13*db781477SPatrick Sanan .seealso: `PetscSFCreate()`, `VecScatter`, `VecScatterCreate()`
140c312b8eSJed Brown S*/
150c312b8eSJed Brown typedef struct _p_PetscSF* PetscSF;
160c312b8eSJed Brown 
1797929ea7SJunchao Zhang /*J
1897929ea7SJunchao Zhang     PetscSFType - String with the name of a PetscSF type
1997929ea7SJunchao Zhang 
2097929ea7SJunchao Zhang    Level: beginner
2197929ea7SJunchao Zhang 
22*db781477SPatrick Sanan .seealso: `PetscSFSetType()`, `PetscSF`
2397929ea7SJunchao Zhang J*/
2497929ea7SJunchao Zhang typedef const char *PetscSFType;
2597929ea7SJunchao Zhang 
26799f573fSMatthew G. Knepley /*S
27799f573fSMatthew G. Knepley    PetscSFNode - specifier of owner and index
28799f573fSMatthew G. Knepley 
29799f573fSMatthew G. Knepley    Level: beginner
30799f573fSMatthew G. Knepley 
3138ab3f8aSBarry Smith   Sample Usage:
3238ab3f8aSBarry Smith $      PetscSFNode    *remote;
339566063dSJacob Faibussowitsch $    PetscCall(PetscMalloc1(nleaves,&remote));
3438ab3f8aSBarry Smith $    for (i=0; i<size; i++) {
3538ab3f8aSBarry Smith $      remote[i].rank = i;
3638ab3f8aSBarry Smith $      remote[i].index = rank;
3738ab3f8aSBarry Smith $    }
3838ab3f8aSBarry Smith 
3938ab3f8aSBarry Smith   Sample Fortran Usage:
4038ab3f8aSBarry Smith $     type(PetscSFNode) remote(6)
4138ab3f8aSBarry Smith $      remote(1)%rank  = modulo(rank+size-1,size)
4238ab3f8aSBarry Smith $      remote(1)%index = 1 * stride
4338ab3f8aSBarry Smith 
44*db781477SPatrick Sanan .seealso: `PetscSFSetGraph()`
45799f573fSMatthew G. Knepley S*/
46799f573fSMatthew G. Knepley typedef struct {
47799f573fSMatthew G. Knepley   PetscInt rank;                /* Rank of owner */
48799f573fSMatthew G. Knepley   PetscInt index;               /* Index of node on rank */
49799f573fSMatthew G. Knepley } PetscSFNode;
50799f573fSMatthew G. Knepley 
5197929ea7SJunchao Zhang /*S
5297929ea7SJunchao Zhang      VecScatter - Object used to manage communication of data
5397929ea7SJunchao Zhang        between vectors in parallel. Manages both scatters and gathers
5497929ea7SJunchao Zhang 
5597929ea7SJunchao Zhang    Level: beginner
5697929ea7SJunchao Zhang 
57*db781477SPatrick Sanan .seealso: `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()`
5897929ea7SJunchao Zhang S*/
5997929ea7SJunchao Zhang typedef PetscSF VecScatter;
6097929ea7SJunchao Zhang 
6197929ea7SJunchao Zhang /*J
6297929ea7SJunchao Zhang     VecScatterType - String with the name of a PETSc vector scatter type
6397929ea7SJunchao Zhang 
6497929ea7SJunchao Zhang    Level: beginner
6597929ea7SJunchao Zhang 
66*db781477SPatrick Sanan .seealso: `VecScatterSetType()`, `VecScatter`, `VecScatterCreate()`, `VecScatterDestroy()`
6797929ea7SJunchao Zhang J*/
6897929ea7SJunchao Zhang typedef PetscSFType VecScatterType;
690c312b8eSJed Brown #endif
70