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