1 /* $Id: petscis.h,v 1.54 2000/05/24 22:17:59 balay 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(__PETSCIS_H) 8 #define __PETSCIS_H 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,const int[],IS *); 20 EXTERN int ISCreateBlock(MPI_Comm,int,int,const 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 ISGetLocalSize(IS,int *); 34 EXTERN int ISInvertPermutation(IS,int,IS*); 35 EXTERN int ISView(IS,Viewer); 36 EXTERN int ISEqual(IS,IS,PetscTruth *); 37 EXTERN int ISSort(IS); 38 EXTERN int ISSorted(IS,PetscTruth *); 39 EXTERN int ISDifference(IS,IS,IS*); 40 EXTERN int ISSum(IS,IS,IS*); 41 42 EXTERN int ISBlock(IS,PetscTruth*); 43 EXTERN int ISBlockGetIndices(IS,int *[]); 44 EXTERN int ISBlockRestoreIndices(IS,int *[]); 45 EXTERN int ISBlockGetSize(IS,int *); 46 EXTERN int ISBlockGetBlockSize(IS,int *); 47 48 EXTERN int ISStride(IS,PetscTruth*); 49 EXTERN int ISStrideGetInfo(IS,int *,int*); 50 51 EXTERN int ISStrideToGeneral(IS); 52 53 EXTERN int ISDuplicate(IS,IS*); 54 EXTERN int ISAllGather(IS,IS*); 55 56 /* --------------------------------------------------------------------------*/ 57 58 /* 59 ISLocalToGlobalMappings are mappings from an arbitrary 60 local ordering from 0 to n-1 to a global PETSc ordering 61 used by a vector or matrix. 62 63 Note: mapping from Local to Global is scalable; but Global 64 to Local may not be if the range of global values represented locally 65 is very large. 66 */ 67 #define IS_LTOGM_COOKIE PETSC_COOKIE+12 68 typedef struct _p_ISLocalToGlobalMapping* ISLocalToGlobalMapping; 69 typedef enum {IS_GTOLM_MASK,IS_GTOLM_DROP} ISGlobalToLocalMappingType; 70 71 EXTERN int ISLocalToGlobalMappingCreate(MPI_Comm,int,const int[],ISLocalToGlobalMapping*); 72 EXTERN int ISLocalToGlobalMappingCreateIS(IS,ISLocalToGlobalMapping *); 73 EXTERN int ISLocalToGlobalMappingView(ISLocalToGlobalMapping,Viewer); 74 EXTERN int ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping); 75 EXTERN int ISLocalToGlobalMappingApply(ISLocalToGlobalMapping,int,const int[],int[]); 76 EXTERN int ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping,IS,IS*); 77 EXTERN int ISGlobalToLocalMappingApply(ISLocalToGlobalMapping,ISGlobalToLocalMappingType, 78 int,const int[],int*,int[]); 79 80 /* --------------------------------------------------------------------------*/ 81 82 /* 83 ISColorings are sets of IS's that define a coloring 84 of the underlying indices 85 */ 86 struct _p_ISColoring { 87 int n; 88 IS *is; 89 MPI_Comm comm; 90 }; 91 typedef struct _p_ISColoring* ISColoring; 92 93 EXTERN int ISColoringCreate(MPI_Comm,int,const int[],ISColoring*); 94 EXTERN int ISColoringDestroy(ISColoring); 95 EXTERN int ISColoringView(ISColoring,Viewer); 96 EXTERN int ISColoringGetIS(ISColoring,int*,IS*[]); 97 EXTERN int ISColoringRestoreIS(ISColoring,IS*[]); 98 99 /* --------------------------------------------------------------------------*/ 100 101 EXTERN int ISPartitioningToNumbering(IS,IS*); 102 EXTERN int ISPartitioningCount(IS,int[]); 103 104 #endif 105 106 107 108 109