1 /* $Id: is.h,v 1.38 1997/09/26 02:22:17 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 extern int ISDifference(IS,IS,IS*); 39 40 extern int ISBlock(IS,PetscTruth*); 41 extern int ISBlockGetIndices(IS,int **); 42 extern int ISBlockRestoreIndices(IS,int **); 43 extern int ISBlockGetSize(IS,int *); 44 extern int ISBlockGetBlockSize(IS,int *); 45 46 extern int ISStride(IS,PetscTruth*); 47 extern int ISStrideGetInfo(IS,int *,int*); 48 49 extern int ISDuplicate(IS, IS *); 50 /* --------------------------------------------------------------------------*/ 51 52 /* 53 ISLocalToGlobalMappings are mappings from an arbitrary 54 local ordering from 0 to n-1 to a global PETSc ordering 55 used by a vector or matrix. 56 57 Note: mapping from Local to Global is scalable; but Global 58 to local may not be if the range of global values represented locally 59 is very large. 60 */ 61 #define IS_LTOGM_COOKIE PETSC_COOKIE+12 62 typedef struct _p_ISLocalToGlobalMapping* ISLocalToGlobalMapping; 63 64 extern int ISLocalToGlobalMappingCreate(MPI_Comm,int, int*, ISLocalToGlobalMapping*); 65 extern int ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping); 66 extern int ISLocalToGlobalMappingApply(ISLocalToGlobalMapping,int,int*,int *); 67 extern int ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping,IS,IS*); 68 typedef enum {IS_GTOLM_MASK,IS_GTOLM_DROP} ISGlobalToLocalMappingType; 69 extern int ISGlobalToLocalMappingApply(ISLocalToGlobalMapping,ISGlobalToLocalMappingType, 70 int,int *,int*,int *); 71 72 /* --------------------------------------------------------------------------*/ 73 74 /* 75 ISColorings are sets of IS's that define a coloring 76 of the underlying indices 77 */ 78 struct _p_ISColoring { 79 int n; 80 IS *is; 81 MPI_Comm comm; 82 }; 83 typedef struct _p_ISColoring* ISColoring; 84 85 extern int ISColoringDestroy(ISColoring); 86 extern int ISColoringView(ISColoring,Viewer); 87 extern int ISColoringCreate(MPI_Comm,int,int*,ISColoring*); 88 89 /* --------------------------------------------------------------------------*/ 90 91 /* 92 ISPartitioning are sets of IS's that define a partioning 93 of the underlying indices. This is the same as a ISColoring. 94 */ 95 #define ISPartitioning ISColoring 96 #define ISPartitioningView ISColoringView 97 #define ISPartitioningCreate ISColoringCreate 98 #define ISPartitioningDestroy ISColoringDestroy 99 extern int ISPartitioningToLocalIS(ISPartitioning,IS*); 100 101 #endif 102 103 104 105 106