xref: /petsc/include/petscis.h (revision 5a5d4f665b3034485fbcdfbe42345f740a4bd170)
1 /* $Id: is.h,v 1.41 1997/10/28 14:26:00 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 ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping);
70 extern int ISLocalToGlobalMappingApply(ISLocalToGlobalMapping,int,int*,int *);
71 extern int ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping,IS,IS*);
72 typedef enum {IS_GTOLM_MASK,IS_GTOLM_DROP} ISGlobalToLocalMappingType;
73 extern int ISGlobalToLocalMappingApply(ISLocalToGlobalMapping,ISGlobalToLocalMappingType,
74                                        int,int *,int*,int *);
75 
76 /* --------------------------------------------------------------------------*/
77 
78 /*
79      ISColorings are sets of IS's that define a coloring
80    of the underlying indices
81 */
82 struct _p_ISColoring {
83   int      n;
84   IS       *is;
85   MPI_Comm comm;
86 };
87 typedef struct _p_ISColoring* ISColoring;
88 
89 extern int ISColoringDestroy(ISColoring);
90 extern int ISColoringView(ISColoring,Viewer);
91 extern int ISColoringCreate(MPI_Comm,int,int*,ISColoring*);
92 
93 /* --------------------------------------------------------------------------*/
94 
95 extern int ISPartitioningToNumbering(IS,IS*);
96 
97 #endif
98 
99 
100 
101 
102