1*0a835dfdSSatish Balay /* $Id: petscis.h,v 1.51 2000/02/02 21:21:25 bsmith Exp balay $ */ 22eac72dbSBarry Smith 32eac72dbSBarry Smith /* 4f8256253SLois Curfman McInnes An index set is a generalization of a subset of integers. Index sets 5f8256253SLois Curfman McInnes are used for defining scatters and gathers. 62eac72dbSBarry Smith */ 7*0a835dfdSSatish Balay #if !defined(__PETSCIS_H) 8*0a835dfdSSatish Balay #define __PETSCIS_H 92eac72dbSBarry Smith #include "petsc.h" 102eac72dbSBarry Smith 119e25ed09SBarry Smith #define IS_COOKIE PETSC_COOKIE+2 12f0479e8cSBarry Smith 13f09e8eb9SSatish Balay typedef struct _p_IS* IS; 142eac72dbSBarry Smith 15639f9d9dSBarry Smith /* 16639f9d9dSBarry Smith Default index set data structures that PETSc provides. 17639f9d9dSBarry Smith */ 18639f9d9dSBarry Smith typedef enum {IS_GENERAL=0,IS_STRIDE=1,IS_BLOCK = 2} ISType; 19987e4450SSatish Balay extern int ISCreateGeneral(MPI_Comm,int,const int[],IS *); 20987e4450SSatish Balay extern int ISCreateBlock(MPI_Comm,int,int,const int[],IS *); 21537820f0SBarry Smith extern int ISCreateStride(MPI_Comm,int,int,int,IS *); 224b0e389bSBarry Smith 234b0e389bSBarry Smith extern int ISDestroy(IS); 244b0e389bSBarry Smith 25aabeff55SBarry Smith extern int ISSetPermutation(IS); 2677c4ece6SBarry Smith extern int ISPermutation(IS,PetscTruth*); 2708480c60SBarry Smith extern int ISSetIdentity(IS); 2877c4ece6SBarry Smith extern int ISIdentity(IS,PetscTruth*); 2908480c60SBarry Smith 30987e4450SSatish Balay extern int ISGetIndices(IS,int *[]); 31987e4450SSatish Balay extern int ISRestoreIndices(IS,int *[]); 32aabeff55SBarry Smith extern int ISGetSize(IS,int *); 332bad1931SBarry Smith extern int ISInvertPermutation(IS,int,IS*); 34aabeff55SBarry Smith extern int ISView(IS,Viewer); 3577c4ece6SBarry Smith extern int ISEqual(IS,IS,PetscTruth *); 360f453280SSatish Balay extern int ISSort(IS); 3777c4ece6SBarry Smith extern int ISSorted(IS,PetscTruth *); 38ca71c51bSBarry Smith extern int ISDifference(IS,IS,IS*); 392bdab257SBarry Smith extern int ISSum(IS,IS,IS*); 40612dd529SBarry Smith 41537820f0SBarry Smith extern int ISBlock(IS,PetscTruth*); 42987e4450SSatish Balay extern int ISBlockGetIndices(IS,int *[]); 43987e4450SSatish Balay extern int ISBlockRestoreIndices(IS,int *[]); 44537820f0SBarry Smith extern int ISBlockGetSize(IS,int *); 45537820f0SBarry Smith extern int ISBlockGetBlockSize(IS,int *); 46c16cb8f2SBarry Smith 47537820f0SBarry Smith extern int ISStride(IS,PetscTruth*); 48c16cb8f2SBarry Smith extern int ISStrideGetInfo(IS,int *,int*); 49c16cb8f2SBarry Smith 5038f40f24SLois Curfman McInnes extern int ISStrideToGeneral(IS); 5138f40f24SLois Curfman McInnes 52d4bb536fSBarry Smith extern int ISDuplicate(IS,IS*); 53d64ed03dSBarry Smith extern int ISAllGather(IS,IS*); 54d64ed03dSBarry Smith 5556cd22aeSBarry Smith /* --------------------------------------------------------------------------*/ 5656cd22aeSBarry Smith 57639f9d9dSBarry Smith /* 5890f02eecSBarry Smith ISLocalToGlobalMappings are mappings from an arbitrary 5990f02eecSBarry Smith local ordering from 0 to n-1 to a global PETSc ordering 60d4bb536fSBarry Smith used by a vector or matrix. 61d4bb536fSBarry Smith 62d4bb536fSBarry Smith Note: mapping from Local to Global is scalable; but Global 63eec0b4cfSBarry Smith to Local may not be if the range of global values represented locally 64d4bb536fSBarry Smith is very large. 6590f02eecSBarry Smith */ 66d4bb536fSBarry Smith #define IS_LTOGM_COOKIE PETSC_COOKIE+12 67f09e8eb9SSatish Balay typedef struct _p_ISLocalToGlobalMapping* ISLocalToGlobalMapping; 68987e4450SSatish Balay typedef enum {IS_GTOLM_MASK,IS_GTOLM_DROP} ISGlobalToLocalMappingType; 6990f02eecSBarry Smith 70987e4450SSatish Balay extern int ISLocalToGlobalMappingCreate(MPI_Comm,int,const int[],ISLocalToGlobalMapping*); 712bdab257SBarry Smith extern int ISLocalToGlobalMappingCreateIS(IS,ISLocalToGlobalMapping *); 72ea06a074SBarry Smith extern int ISLocalToGlobalMappingView(ISLocalToGlobalMapping,Viewer); 7390f02eecSBarry Smith extern int ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping); 74987e4450SSatish Balay extern int ISLocalToGlobalMappingApply(ISLocalToGlobalMapping,int,const int[],int[]); 7590f02eecSBarry Smith extern int ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping,IS,IS*); 76d4bb536fSBarry Smith extern int ISGlobalToLocalMappingApply(ISLocalToGlobalMapping,ISGlobalToLocalMappingType, 77987e4450SSatish Balay int,const int[],int*,int[]); 7890f02eecSBarry Smith 7956cd22aeSBarry Smith /* --------------------------------------------------------------------------*/ 8056cd22aeSBarry Smith 8190f02eecSBarry Smith /* 82639f9d9dSBarry Smith ISColorings are sets of IS's that define a coloring 83639f9d9dSBarry Smith of the underlying indices 84639f9d9dSBarry Smith */ 85f09e8eb9SSatish Balay struct _p_ISColoring { 86639f9d9dSBarry Smith int n; 87639f9d9dSBarry Smith IS *is; 88639f9d9dSBarry Smith MPI_Comm comm; 89639f9d9dSBarry Smith }; 90f09e8eb9SSatish Balay typedef struct _p_ISColoring* ISColoring; 91639f9d9dSBarry Smith 92987e4450SSatish Balay extern int ISColoringCreate(MPI_Comm,int,const int[],ISColoring*); 93639f9d9dSBarry Smith extern int ISColoringDestroy(ISColoring); 94639f9d9dSBarry Smith extern int ISColoringView(ISColoring,Viewer); 95987e4450SSatish Balay extern int ISColoringGetIS(ISColoring,int*,IS*[]); 96639f9d9dSBarry Smith 97dbef8a1cSBarry Smith /* --------------------------------------------------------------------------*/ 98dbef8a1cSBarry Smith 99ca161407SBarry Smith extern int ISPartitioningToNumbering(IS,IS*); 100987e4450SSatish Balay extern int ISPartitioningCount(IS,int[]); 101dbef8a1cSBarry Smith 102a2ce50c7SBarry Smith #endif 1037588ac45SBarry Smith 1047588ac45SBarry Smith 105639f9d9dSBarry Smith 106639f9d9dSBarry Smith 107