126bd1501SBarry Smith #if !defined(PETSCSFTYPES_H) 226bd1501SBarry Smith #define PETSCSFTYPES_H 30c312b8eSJed Brown 4*ac09b921SBarry Smith /* SUBMANSEC = PetscSF */ 5*ac09b921SBarry Smith 60c312b8eSJed Brown /*S 70c312b8eSJed Brown PetscSF - PETSc object for setting up and managing the communication of certain entries of arrays and Vecs between MPI processes. 80c312b8eSJed Brown 90c312b8eSJed Brown Level: intermediate 100c312b8eSJed Brown 110c312b8eSJed Brown 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 2097929ea7SJunchao Zhang 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; 2797929ea7SJunchao Zhang 28799f573fSMatthew G. Knepley /*S 29799f573fSMatthew G. Knepley PetscSFNode - specifier of owner and index 30799f573fSMatthew G. Knepley 31799f573fSMatthew G. Knepley Level: beginner 32799f573fSMatthew G. Knepley 3338ab3f8aSBarry Smith Sample Usage: 3438ab3f8aSBarry Smith $ PetscSFNode *remote; 359566063dSJacob Faibussowitsch $ PetscCall(PetscMalloc1(nleaves,&remote)); 3638ab3f8aSBarry Smith $ for (i=0; i<size; i++) { 3738ab3f8aSBarry Smith $ remote[i].rank = i; 3838ab3f8aSBarry Smith $ remote[i].index = rank; 3938ab3f8aSBarry Smith $ } 4038ab3f8aSBarry Smith 4138ab3f8aSBarry Smith Sample Fortran Usage: 4238ab3f8aSBarry Smith $ type(PetscSFNode) remote(6) 4338ab3f8aSBarry Smith $ remote(1)%rank = modulo(rank+size-1,size) 4438ab3f8aSBarry Smith $ remote(1)%index = 1 * stride 4538ab3f8aSBarry Smith 46db781477SPatrick Sanan .seealso: `PetscSFSetGraph()` 47799f573fSMatthew G. Knepley S*/ 48799f573fSMatthew G. Knepley typedef struct { 49799f573fSMatthew G. Knepley PetscInt rank; /* Rank of owner */ 50799f573fSMatthew G. Knepley PetscInt index; /* Index of node on rank */ 51799f573fSMatthew G. Knepley } PetscSFNode; 52799f573fSMatthew G. Knepley 5397929ea7SJunchao Zhang /*S 5497929ea7SJunchao Zhang VecScatter - Object used to manage communication of data 5597929ea7SJunchao Zhang between vectors in parallel. Manages both scatters and gathers 5697929ea7SJunchao Zhang 5797929ea7SJunchao Zhang Level: beginner 5897929ea7SJunchao Zhang 59db781477SPatrick Sanan .seealso: `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()` 6097929ea7SJunchao Zhang S*/ 6197929ea7SJunchao Zhang typedef PetscSF VecScatter; 6297929ea7SJunchao Zhang 6397929ea7SJunchao Zhang /*J 6497929ea7SJunchao Zhang VecScatterType - String with the name of a PETSc vector scatter type 6597929ea7SJunchao Zhang 6697929ea7SJunchao Zhang Level: beginner 6797929ea7SJunchao Zhang 68db781477SPatrick Sanan .seealso: `VecScatterSetType()`, `VecScatter`, `VecScatterCreate()`, `VecScatterDestroy()` 6997929ea7SJunchao Zhang J*/ 7097929ea7SJunchao Zhang typedef PetscSFType VecScatterType; 710c312b8eSJed Brown #endif 72