1 /* $Id: is.h,v 1.36 1997/08/22 15:20:23 bsmith Exp bsmith $ */ 2 3 /* 4 An index set is a generalization of a subset of integers. Index sets 5 are used for defining scatters and gathers. 6 */ 7 #if !defined(__IS_PACKAGE) 8 #define __IS_PACKAGE 9 #include "petsc.h" 10 11 #define IS_COOKIE PETSC_COOKIE+2 12 13 typedef struct _p_IS* IS; 14 15 /* 16 Default index set data structures that PETSc provides. 17 */ 18 typedef enum {IS_GENERAL=0, IS_STRIDE=1, IS_BLOCK = 2} ISType; 19 extern int ISCreateGeneral(MPI_Comm,int,int *,IS *); 20 extern int ISCreateBlock(MPI_Comm,int,int,int *,IS *); 21 extern int ISCreateStride(MPI_Comm,int,int,int,IS *); 22 23 extern int ISDestroy(IS); 24 25 extern int ISSetPermutation(IS); 26 extern int ISPermutation(IS,PetscTruth*); 27 extern int ISSetIdentity(IS); 28 extern int ISIdentity(IS,PetscTruth*); 29 30 extern int ISGetIndices(IS,int **); 31 extern int ISRestoreIndices(IS,int **); 32 extern int ISGetSize(IS,int *); 33 extern int ISInvertPermutation(IS,IS*); 34 extern int ISView(IS,Viewer); 35 extern int ISEqual(IS, IS, PetscTruth *); 36 extern int ISSort(IS); 37 extern int ISSorted(IS, PetscTruth *); 38 39 extern int ISBlock(IS,PetscTruth*); 40 extern int ISBlockGetIndices(IS,int **); 41 extern int ISBlockRestoreIndices(IS,int **); 42 extern int ISBlockGetSize(IS,int *); 43 extern int ISBlockGetBlockSize(IS,int *); 44 45 extern int ISStride(IS,PetscTruth*); 46 extern int ISStrideGetInfo(IS,int *,int*); 47 48 extern int ISDuplicate(IS, IS *); 49 /* --------------------------------------------------------------------------*/ 50 51 /* 52 ISLocalToGlobalMappings are mappings from an arbitrary 53 local ordering from 0 to n-1 to a global PETSc ordering 54 used by a vector or matrix. 55 56 Note: mapping from Local to Global is scalable; but Global 57 to local may not be if the range of global values represented locally 58 is very large. 59 */ 60 #define IS_LTOGM_COOKIE PETSC_COOKIE+12 61 typedef struct _p_ISLocalToGlobalMapping* ISLocalToGlobalMapping; 62 63 extern int ISLocalToGlobalMappingCreate(MPI_Comm,int, int*, ISLocalToGlobalMapping*); 64 extern int ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping); 65 extern int ISLocalToGlobalMappingApply(ISLocalToGlobalMapping,int,int*,int *); 66 extern int ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping,IS,IS*); 67 typedef enum {IS_GTOLM_MASK,IS_GTOLM_DROP} ISGlobalToLocalMappingType; 68 extern int ISGlobalToLocalMappingApply(ISLocalToGlobalMapping,ISGlobalToLocalMappingType, 69 int,int *,int*,int *); 70 71 /* --------------------------------------------------------------------------*/ 72 73 /* 74 ISColorings are sets of IS's that define a coloring 75 of the underlying indices 76 */ 77 struct _p_ISColoring { 78 int n; 79 IS *is; 80 MPI_Comm comm; 81 }; 82 typedef struct _p_ISColoring* ISColoring; 83 84 extern int ISColoringDestroy(ISColoring); 85 extern int ISColoringView(ISColoring,Viewer); 86 extern int ISColoringCreate(MPI_Comm,int,int*,ISColoring*); 87 88 /* --------------------------------------------------------------------------*/ 89 90 /* 91 ISPartitioning are sets of IS's that define a partioning 92 of the underlying indices. This is the same as a ISColoring. 93 */ 94 #define ISPartitioning ISColoring 95 96 97 98 #endif 99 100 101 102 103