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