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; 2720662ed9SBarry Smith #define PETSCSFBASIC "basic" 2820662ed9SBarry Smith #define PETSCSFNEIGHBOR "neighbor" 2920662ed9SBarry Smith #define PETSCSFALLGATHERV "allgatherv" 3020662ed9SBarry Smith #define PETSCSFALLGATHER "allgather" 3120662ed9SBarry Smith #define PETSCSFGATHERV "gatherv" 3220662ed9SBarry Smith #define PETSCSFGATHER "gather" 3320662ed9SBarry Smith #define PETSCSFALLTOALL "alltoall" 3420662ed9SBarry 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: 42*16a05f60SBarry Smith .vb 43*16a05f60SBarry Smith PetscSFNode *remote; 44*16a05f60SBarry Smith PetscCall(PetscMalloc1(nleaves,&remote)); 45*16a05f60SBarry Smith for (i=0; i<size; i++) { 46*16a05f60SBarry Smith remote[i].rank = i; 47*16a05f60SBarry Smith remote[i].index = rank; 48*16a05f60SBarry Smith } 49*16a05f60SBarry Smith .ve 5038ab3f8aSBarry Smith 5138ab3f8aSBarry Smith Sample Fortran Usage: 52*16a05f60SBarry Smith .vb 53*16a05f60SBarry Smith type(PetscSFNode) remote(6) 54*16a05f60SBarry Smith remote(1)%rank = modulo(rank+size-1,size) 55*16a05f60SBarry Smith remote(1)%index = 1 * stride 56*16a05f60SBarry Smith .ve 5738ab3f8aSBarry Smith 58*16a05f60SBarry Smith .seealso: `PetscSF`, `PetscSFSetGraph()` 59799f573fSMatthew G. Knepley S*/ 60799f573fSMatthew G. Knepley typedef struct { 61799f573fSMatthew G. Knepley PetscInt rank; /* Rank of owner */ 62799f573fSMatthew G. Knepley PetscInt index; /* Index of node on rank */ 63799f573fSMatthew G. Knepley } PetscSFNode; 64799f573fSMatthew G. Knepley 6597929ea7SJunchao Zhang /*S 6697929ea7SJunchao Zhang VecScatter - Object used to manage communication of data 6797929ea7SJunchao Zhang between vectors in parallel. Manages both scatters and gathers 6897929ea7SJunchao Zhang 6997929ea7SJunchao Zhang Level: beginner 7097929ea7SJunchao Zhang 7187497f52SBarry Smith .seealso: `Vec`, `PetscSF`, `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()` 7297929ea7SJunchao Zhang S*/ 7397929ea7SJunchao Zhang typedef PetscSF VecScatter; 7497929ea7SJunchao Zhang 7597929ea7SJunchao Zhang /*J 7697929ea7SJunchao Zhang VecScatterType - String with the name of a PETSc vector scatter type 7797929ea7SJunchao Zhang 7897929ea7SJunchao Zhang Level: beginner 7997929ea7SJunchao Zhang 8087497f52SBarry Smith .seealso: `PetscSFType`, `VecScatterSetType()`, `VecScatter`, `VecScatterCreate()`, `VecScatterDestroy()` 8197929ea7SJunchao Zhang J*/ 8297929ea7SJunchao Zhang typedef PetscSFType VecScatterType; 830c312b8eSJed Brown #endif 84