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