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 139448b7f1SJunchao Zhang .seealso: PetscSFCreate(), VecScatter, VecScatterCreate() 140c312b8eSJed Brown S*/ 150c312b8eSJed Brown typedef struct _p_PetscSF* PetscSF; 160c312b8eSJed Brown 17*97929ea7SJunchao Zhang /*J 18*97929ea7SJunchao Zhang PetscSFType - String with the name of a PetscSF type 19*97929ea7SJunchao Zhang 20*97929ea7SJunchao Zhang Level: beginner 21*97929ea7SJunchao Zhang 22*97929ea7SJunchao Zhang .seealso: PetscSFSetType(), PetscSF 23*97929ea7SJunchao Zhang J*/ 24*97929ea7SJunchao Zhang typedef const char *PetscSFType; 25*97929ea7SJunchao 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; 3338ab3f8aSBarry Smith $ ierr = PetscMalloc1(nleaves,&remote);CHKERRQ(ierr); 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 44799f573fSMatthew G. Knepley .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 51*97929ea7SJunchao Zhang /*S 52*97929ea7SJunchao Zhang VecScatter - Object used to manage communication of data 53*97929ea7SJunchao Zhang between vectors in parallel. Manages both scatters and gathers 54*97929ea7SJunchao Zhang 55*97929ea7SJunchao Zhang Level: beginner 56*97929ea7SJunchao Zhang 57*97929ea7SJunchao Zhang .seealso: VecScatterCreate(), VecScatterBegin(), VecScatterEnd() 58*97929ea7SJunchao Zhang S*/ 59*97929ea7SJunchao Zhang typedef PetscSF VecScatter; 60*97929ea7SJunchao Zhang 61*97929ea7SJunchao Zhang /*J 62*97929ea7SJunchao Zhang VecScatterType - String with the name of a PETSc vector scatter type 63*97929ea7SJunchao Zhang 64*97929ea7SJunchao Zhang Level: beginner 65*97929ea7SJunchao Zhang 66*97929ea7SJunchao Zhang .seealso: VecScatterSetType(), VecScatter, VecScatterCreate(), VecScatterDestroy() 67*97929ea7SJunchao Zhang J*/ 68*97929ea7SJunchao Zhang typedef PetscSFType VecScatterType; 690c312b8eSJed Brown #endif 70