1 #if !defined(PETSCSFTYPES_H) 2 #define PETSCSFTYPES_H 3 4 /*S 5 PetscSF - PETSc object for setting up and managing the communication of certain entries of arrays and Vecs between MPI processes. 6 7 Level: intermediate 8 9 PetscSF uses the concept of star forests to indicate and determine the communication patterns concisely and efficiently. 10 A star https://en.wikipedia.org/wiki/Star_(graph_theory) forest is simply a collection of trees of height 1. The leave nodes represent 11 "ghost locations" for the root nodes. 12 13 .seealso: PetscSFCreate(), VecScatter, VecScatterCreate() 14 S*/ 15 typedef struct _p_PetscSF* PetscSF; 16 17 /*S 18 PetscSFNode - specifier of owner and index 19 20 Level: beginner 21 22 Sample Usage: 23 $ PetscSFNode *remote; 24 $ ierr = PetscMalloc1(nleaves,&remote);CHKERRQ(ierr); 25 $ for (i=0; i<size; i++) { 26 $ remote[i].rank = i; 27 $ remote[i].index = rank; 28 $ } 29 30 Sample Fortran Usage: 31 $ type(PetscSFNode) remote(6) 32 $ remote(1)%rank = modulo(rank+size-1,size) 33 $ remote(1)%index = 1 * stride 34 35 .seealso: PetscSFSetGraph() 36 S*/ 37 typedef struct { 38 PetscInt rank; /* Rank of owner */ 39 PetscInt index; /* Index of node on rank */ 40 } PetscSFNode; 41 42 #endif 43