xref: /petsc/include/petscis.h (revision fe998a80077c9ee0917a39496df43fc256e1b478)
1 /*
2    An index set is a generalization of a subset of integers.  Index sets
3    are used for defining scatters and gathers.
4 */
5 #if !defined(__PETSCIS_H)
6 #define __PETSCIS_H
7 #include <petscsys.h>
8 #include <petscsftypes.h>
9 #include <petscistypes.h>
10 
11 #define IS_FILE_CLASSID 1211218
12 PETSC_EXTERN PetscClassId IS_CLASSID;
13 
14 PETSC_EXTERN PetscErrorCode ISInitializePackage(void);
15 
16 /*J
17     ISType - String with the name of a PETSc index set type
18 
19    Level: beginner
20 
21 .seealso: ISSetType(), IS, ISCreate(), ISRegister()
22 J*/
23 typedef const char* ISType;
24 #define ISGENERAL      "general"
25 #define ISSTRIDE       "stride"
26 #define ISBLOCK        "block"
27 
28 /* Dynamic creation and loading functions */
29 PETSC_EXTERN PetscFunctionList ISList;
30 PETSC_EXTERN PetscBool         ISRegisterAllCalled;
31 PETSC_EXTERN PetscErrorCode ISSetType(IS, ISType);
32 PETSC_EXTERN PetscErrorCode ISGetType(IS, ISType *);
33 PETSC_EXTERN PetscErrorCode ISRegister(const char[],PetscErrorCode (*)(IS));
34 PETSC_EXTERN PetscErrorCode ISRegisterAll(void);
35 PETSC_EXTERN PetscErrorCode ISCreate(MPI_Comm,IS*);
36 
37 /*
38     Default index set data structures that PETSc provides.
39 */
40 PETSC_EXTERN PetscErrorCode ISCreateGeneral(MPI_Comm,PetscInt,const PetscInt[],PetscCopyMode,IS *);
41 PETSC_EXTERN PetscErrorCode ISGeneralSetIndices(IS,PetscInt,const PetscInt[],PetscCopyMode);
42 PETSC_EXTERN PetscErrorCode ISCreateBlock(MPI_Comm,PetscInt,PetscInt,const PetscInt[],PetscCopyMode,IS *);
43 PETSC_EXTERN PetscErrorCode ISBlockSetIndices(IS,PetscInt,PetscInt,const PetscInt[],PetscCopyMode);
44 PETSC_EXTERN PetscErrorCode ISCreateStride(MPI_Comm,PetscInt,PetscInt,PetscInt,IS *);
45 PETSC_EXTERN PetscErrorCode ISStrideSetStride(IS,PetscInt,PetscInt,PetscInt);
46 
47 PETSC_EXTERN PetscErrorCode ISDestroy(IS*);
48 PETSC_EXTERN PetscErrorCode ISSetPermutation(IS);
49 PETSC_EXTERN PetscErrorCode ISPermutation(IS,PetscBool *);
50 PETSC_EXTERN PetscErrorCode ISSetIdentity(IS);
51 PETSC_EXTERN PetscErrorCode ISIdentity(IS,PetscBool *);
52 PETSC_EXTERN PetscErrorCode ISContiguousLocal(IS,PetscInt,PetscInt,PetscInt*,PetscBool*);
53 
54 PETSC_EXTERN PetscErrorCode ISGetIndices(IS,const PetscInt *[]);
55 PETSC_EXTERN PetscErrorCode ISRestoreIndices(IS,const PetscInt *[]);
56 PETSC_EXTERN PetscErrorCode ISGetTotalIndices(IS,const PetscInt *[]);
57 PETSC_EXTERN PetscErrorCode ISRestoreTotalIndices(IS,const PetscInt *[]);
58 PETSC_EXTERN PetscErrorCode ISGetNonlocalIndices(IS,const PetscInt *[]);
59 PETSC_EXTERN PetscErrorCode ISRestoreNonlocalIndices(IS,const PetscInt *[]);
60 PETSC_EXTERN PetscErrorCode ISGetNonlocalIS(IS, IS *is);
61 PETSC_EXTERN PetscErrorCode ISRestoreNonlocalIS(IS, IS *is);
62 PETSC_EXTERN PetscErrorCode ISGetSize(IS,PetscInt *);
63 PETSC_EXTERN PetscErrorCode ISGetLocalSize(IS,PetscInt *);
64 PETSC_EXTERN PetscErrorCode ISInvertPermutation(IS,PetscInt,IS*);
65 PETSC_EXTERN PetscErrorCode ISView(IS,PetscViewer);
66 PETSC_STATIC_INLINE PetscErrorCode ISViewFromOptions(IS A,const char prefix[],const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,prefix,name);}
67 PETSC_EXTERN PetscErrorCode ISLoad(IS,PetscViewer);
68 PETSC_EXTERN PetscErrorCode ISEqual(IS,IS,PetscBool  *);
69 PETSC_EXTERN PetscErrorCode ISSort(IS);
70 PETSC_EXTERN PetscErrorCode ISSortRemoveDups(IS);
71 PETSC_EXTERN PetscErrorCode ISSorted(IS,PetscBool  *);
72 PETSC_EXTERN PetscErrorCode ISDifference(IS,IS,IS*);
73 PETSC_EXTERN PetscErrorCode ISSum(IS,IS,IS*);
74 PETSC_EXTERN PetscErrorCode ISExpand(IS,IS,IS*);
75 PETSC_EXTERN PetscErrorCode ISGetMinMax(IS,PetscInt*,PetscInt*);
76 
77 PETSC_EXTERN PetscErrorCode ISBlockGetIndices(IS,const PetscInt *[]);
78 PETSC_EXTERN PetscErrorCode ISBlockRestoreIndices(IS,const PetscInt *[]);
79 PETSC_EXTERN PetscErrorCode ISBlockGetLocalSize(IS,PetscInt *);
80 PETSC_EXTERN PetscErrorCode ISBlockGetSize(IS,PetscInt *);
81 PETSC_EXTERN PetscErrorCode ISGetBlockSize(IS,PetscInt*);
82 PETSC_EXTERN PetscErrorCode ISSetBlockSize(IS,PetscInt);
83 
84 PETSC_EXTERN PetscErrorCode ISStrideGetInfo(IS,PetscInt *,PetscInt*);
85 
86 PETSC_EXTERN PetscErrorCode ISToGeneral(IS);
87 
88 PETSC_EXTERN PetscErrorCode ISDuplicate(IS,IS*);
89 PETSC_EXTERN PetscErrorCode ISCopy(IS,IS);
90 PETSC_EXTERN PetscErrorCode ISAllGather(IS,IS*);
91 PETSC_EXTERN PetscErrorCode ISComplement(IS,PetscInt,PetscInt,IS*);
92 PETSC_EXTERN PetscErrorCode ISConcatenate(MPI_Comm,PetscInt,const IS[],IS*);
93 PETSC_EXTERN PetscErrorCode ISListToPair(MPI_Comm,PetscInt, IS[],IS*,IS*);
94 PETSC_EXTERN PetscErrorCode ISPairToList(IS,IS,PetscInt*, IS *[]);
95 PETSC_EXTERN PetscErrorCode ISEmbed(IS,IS,PetscBool,IS*);
96 PETSC_EXTERN PetscErrorCode ISOnComm(IS,MPI_Comm,PetscCopyMode,IS*);
97 
98 /* --------------------------------------------------------------------------*/
99 PETSC_EXTERN PetscClassId IS_LTOGM_CLASSID;
100 
101 /*E
102     ISGlobalToLocalMappingType - Indicates if missing global indices are
103 
104    IS_GTOLM_MASK - missing global indices are replaced with -1
105    IS_GTOLM_DROP - missing global indices are dropped
106 
107    Level: beginner
108 
109 .seealso: ISGlobalToLocalMappingApplyBlock()
110 
111 E*/
112 typedef enum {IS_GTOLM_MASK,IS_GTOLM_DROP} ISGlobalToLocalMappingType;
113 
114 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreate(MPI_Comm,PetscInt,PetscInt,const PetscInt[],PetscCopyMode,ISLocalToGlobalMapping*);
115 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreateIS(IS,ISLocalToGlobalMapping *);
116 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreateSF(PetscSF,PetscInt,ISLocalToGlobalMapping*);
117 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingView(ISLocalToGlobalMapping,PetscViewer);
118 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping*);
119 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApply(ISLocalToGlobalMapping,PetscInt,const PetscInt[],PetscInt[]);
120 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApplyBlock(ISLocalToGlobalMapping,PetscInt,const PetscInt[],PetscInt[]);
121 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping,IS,IS*);
122 PETSC_EXTERN PetscErrorCode ISGlobalToLocalMappingApply(ISLocalToGlobalMapping,ISGlobalToLocalMappingType,PetscInt,const PetscInt[],PetscInt*,PetscInt[]);
123 PETSC_EXTERN PetscErrorCode ISGlobalToLocalMappingApplyBlock(ISLocalToGlobalMapping,ISGlobalToLocalMappingType,PetscInt,const PetscInt[],PetscInt*,PetscInt[]);
124 PETSC_EXTERN PetscErrorCode ISGlobalToLocalMappingApplyIS(ISLocalToGlobalMapping,ISGlobalToLocalMappingType,IS,IS*);
125 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetSize(ISLocalToGlobalMapping,PetscInt*);
126 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetInfo(ISLocalToGlobalMapping,PetscInt*,PetscInt*[],PetscInt*[],PetscInt**[]);
127 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreInfo(ISLocalToGlobalMapping,PetscInt*,PetscInt*[],PetscInt*[],PetscInt**[]);
128 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetBlockInfo(ISLocalToGlobalMapping,PetscInt*,PetscInt*[],PetscInt*[],PetscInt**[]);
129 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreBlockInfo(ISLocalToGlobalMapping,PetscInt*,PetscInt*[],PetscInt*[],PetscInt**[]);
130 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetIndices(ISLocalToGlobalMapping,const PetscInt**);
131 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreIndices(ISLocalToGlobalMapping,const PetscInt**);
132 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetBlockIndices(ISLocalToGlobalMapping,const PetscInt**);
133 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreBlockIndices(ISLocalToGlobalMapping,const PetscInt**);
134 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingConcatenate(MPI_Comm,PetscInt,const ISLocalToGlobalMapping[],ISLocalToGlobalMapping*);
135 PETSC_EXTERN PetscErrorCode ISG2LMapApply(ISLocalToGlobalMapping,PetscInt,const PetscInt[],PetscInt[]);
136 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetBlockSize(ISLocalToGlobalMapping,PetscInt*);
137 
138 
139 /* --------------------------------------------------------------------------*/
140 /*E
141     ISColoringType - determines if the coloring is for the entire parallel grid/graph/matrix
142                      or for just the local ghosted portion
143 
144     Level: beginner
145 
146 $   IS_COLORING_GLOBAL - does not include the colors for ghost points, this is used when the function
147 $                        is called synchronously in parallel. This requires generating a "parallel coloring".
148 $   IS_COLORING_GHOSTED - includes colors for ghost points, this is used when the function can be called
149 $                         seperately on individual processes with the ghost points already filled in. Does not
150 $                         require a "parallel coloring", rather each process colors its local + ghost part.
151 $                         Using this can result in much less parallel communication. In the paradigm of
152 $                         DMGetLocalVector() and DMGetGlobalVector() this could be called IS_COLORING_LOCAL
153 
154 .seealso: DMCreateColoring()
155 E*/
156 typedef enum {IS_COLORING_GLOBAL,IS_COLORING_GHOSTED} ISColoringType;
157 PETSC_EXTERN const char *const ISColoringTypes[];
158 typedef unsigned PETSC_IS_COLOR_VALUE_TYPE ISColoringValue;
159 PETSC_EXTERN PetscErrorCode ISAllGatherColors(MPI_Comm,PetscInt,ISColoringValue*,PetscInt*,ISColoringValue*[]);
160 
161 PETSC_EXTERN PetscErrorCode ISColoringCreate(MPI_Comm,PetscInt,PetscInt,const ISColoringValue[],PetscCopyMode,ISColoring*);
162 PETSC_EXTERN PetscErrorCode ISColoringDestroy(ISColoring*);
163 PETSC_EXTERN PetscErrorCode ISColoringView(ISColoring,PetscViewer);
164 PETSC_EXTERN PetscErrorCode ISColoringViewFromOptions(ISColoring,const char[],const char[]);
165 PETSC_EXTERN PetscErrorCode ISColoringGetIS(ISColoring,PetscInt*,IS*[]);
166 PETSC_EXTERN PetscErrorCode ISColoringRestoreIS(ISColoring,IS*[]);
167 PETSC_EXTERN PetscErrorCode ISColoringReference(ISColoring);
168 PETSC_EXTERN PetscErrorCode ISColoringSetType(ISColoring,ISColoringType);
169 
170 
171 /* --------------------------------------------------------------------------*/
172 
173 PETSC_EXTERN PetscErrorCode ISPartitioningToNumbering(IS,IS*);
174 PETSC_EXTERN PetscErrorCode ISPartitioningCount(IS,PetscInt,PetscInt[]);
175 
176 PETSC_EXTERN PetscErrorCode ISCompressIndicesGeneral(PetscInt,PetscInt,PetscInt,PetscInt,const IS[],IS[]);
177 PETSC_EXTERN PetscErrorCode ISCompressIndicesSorted(PetscInt,PetscInt,PetscInt,const IS[],IS[]);
178 PETSC_EXTERN PetscErrorCode ISExpandIndicesGeneral(PetscInt,PetscInt,PetscInt,PetscInt,const IS[],IS[]);
179 
180 
181 struct _n_PetscLayout{
182   MPI_Comm               comm;
183   PetscInt               n,N;         /* local, global vector size */
184   PetscInt               rstart,rend; /* local start, local end + 1 */
185   PetscInt               *range;      /* the offset of each processor */
186   PetscInt               bs;          /* number of elements in each block (generally for multi-component
187                                        * problems). Defaults to -1 and can be arbitrarily lazy so always use
188                                        * PetscAbs(map->bs) when accessing directly and expecting result to be
189                                        * positive. Do NOT multiply above numbers by bs */
190   PetscInt               refcnt;      /* MPI Vecs obtained with VecDuplicate() and from MatCreateVecs() reuse map of input object */
191   ISLocalToGlobalMapping mapping;     /* mapping used in Vec/MatSetValuesLocal() */
192   PetscInt               *trstarts;   /* local start for each thread */
193 };
194 
195 #undef __FUNCT__
196 #define __FUNCT__ "PetscLayoutFindOwner"
197 /*@C
198      PetscLayoutFindOwner - Find the owning rank for a global index
199 
200     Not Collective
201 
202    Input Parameters:
203 +    map - the layout
204 -    idx - global index to find the owner of
205 
206    Output Parameter:
207 .    owner - the owning rank
208 
209    Level: developer
210 
211     Fortran Notes:
212       Not available from Fortran
213 
214 @*/
215 PETSC_STATIC_INLINE PetscErrorCode PetscLayoutFindOwner(PetscLayout map,PetscInt idx,PetscInt *owner)
216 {
217   PetscErrorCode ierr;
218   PetscMPIInt    lo = 0,hi,t;
219 
220   PetscFunctionBegin;
221   *owner = -1;                  /* GCC erroneously issues warning about possibly uninitialized use when error condition */
222   if (!((map->n >= 0) && (map->N >= 0) && (map->range))) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"PetscLayoutSetUp() must be called first");
223   if (idx < 0 || idx > map->N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Index %D is out of range",idx);
224   ierr = MPI_Comm_size(map->comm,&hi);CHKERRQ(ierr);
225   while (hi - lo > 1) {
226     t = lo + (hi - lo) / 2;
227     if (idx < map->range[t]) hi = t;
228     else                     lo = t;
229   }
230   *owner = lo;
231   PetscFunctionReturn(0);
232 }
233 
234 #undef __FUNCT__
235 #define __FUNCT__ "PetscLayoutFindOwnerIndex"
236 /*@C
237      PetscLayoutFindOwnerIndex - Find the owning rank and the local index for a global index
238 
239     Not Collective
240 
241    Input Parameters:
242 +    map   - the layout
243 -    idx   - global index to find the owner of
244 
245    Output Parameter:
246 +    owner - the owning rank
247 -    lidx  - local index used by the owner for idx
248 
249    Level: developer
250 
251     Fortran Notes:
252       Not available from Fortran
253 
254 @*/
255 PETSC_STATIC_INLINE PetscErrorCode PetscLayoutFindOwnerIndex(PetscLayout map,PetscInt idx,PetscInt *owner, PetscInt *lidx)
256 {
257   PetscErrorCode ierr;
258   PetscMPIInt    lo = 0,hi,t;
259 
260   PetscFunctionBegin;
261   if (!((map->n >= 0) && (map->N >= 0) && (map->range))) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"PetscLayoutSetUp() must be called first");
262   if (idx < 0 || idx > map->N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Index %D is out of range",idx);
263   ierr = MPI_Comm_size(map->comm,&hi);CHKERRQ(ierr);
264   while (hi - lo > 1) {
265     t = lo + (hi - lo) / 2;
266     if (idx < map->range[t]) hi = t;
267     else                     lo = t;
268   }
269   *owner = lo;
270   *lidx  = idx-map->range[lo];
271   PetscFunctionReturn(0);
272 }
273 
274 PETSC_EXTERN PetscErrorCode PetscLayoutCreate(MPI_Comm,PetscLayout*);
275 PETSC_EXTERN PetscErrorCode PetscLayoutSetUp(PetscLayout);
276 PETSC_EXTERN PetscErrorCode PetscLayoutDestroy(PetscLayout*);
277 PETSC_EXTERN PetscErrorCode PetscLayoutDuplicate(PetscLayout,PetscLayout*);
278 PETSC_EXTERN PetscErrorCode PetscLayoutReference(PetscLayout,PetscLayout*);
279 PETSC_EXTERN PetscErrorCode PetscLayoutSetLocalSize(PetscLayout,PetscInt);
280 PETSC_EXTERN PetscErrorCode PetscLayoutGetLocalSize(PetscLayout,PetscInt *);
281 PETSC_EXTERN PetscErrorCode PetscLayoutSetSize(PetscLayout,PetscInt);
282 PETSC_EXTERN PetscErrorCode PetscLayoutGetSize(PetscLayout,PetscInt *);
283 PETSC_EXTERN PetscErrorCode PetscLayoutSetBlockSize(PetscLayout,PetscInt);
284 PETSC_EXTERN PetscErrorCode PetscLayoutGetBlockSize(PetscLayout,PetscInt*);
285 PETSC_EXTERN PetscErrorCode PetscLayoutGetRange(PetscLayout,PetscInt *,PetscInt *);
286 PETSC_EXTERN PetscErrorCode PetscLayoutGetRanges(PetscLayout,const PetscInt *[]);
287 PETSC_EXTERN PetscErrorCode PetscLayoutSetISLocalToGlobalMapping(PetscLayout,ISLocalToGlobalMapping);
288 PETSC_EXTERN PetscErrorCode PetscSFSetGraphLayout(PetscSF,PetscLayout,PetscInt,const PetscInt*,PetscCopyMode,const PetscInt*);
289 
290 PETSC_EXTERN PetscClassId PETSC_SECTION_CLASSID;
291 
292 PETSC_EXTERN PetscErrorCode PetscSectionCreate(MPI_Comm,PetscSection*);
293 PETSC_EXTERN PetscErrorCode PetscSectionClone(PetscSection, PetscSection*);
294 PETSC_EXTERN PetscErrorCode PetscSectionCopy(PetscSection, PetscSection);
295 PETSC_EXTERN PetscErrorCode PetscSectionGetNumFields(PetscSection, PetscInt *);
296 PETSC_EXTERN PetscErrorCode PetscSectionSetNumFields(PetscSection, PetscInt);
297 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldName(PetscSection, PetscInt, const char *[]);
298 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldName(PetscSection, PetscInt, const char []);
299 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldComponents(PetscSection, PetscInt, PetscInt *);
300 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldComponents(PetscSection, PetscInt, PetscInt);
301 PETSC_EXTERN PetscErrorCode PetscSectionGetChart(PetscSection, PetscInt *, PetscInt *);
302 PETSC_EXTERN PetscErrorCode PetscSectionSetChart(PetscSection, PetscInt, PetscInt);
303 PETSC_EXTERN PetscErrorCode PetscSectionGetPermutation(PetscSection, IS *);
304 PETSC_EXTERN PetscErrorCode PetscSectionSetPermutation(PetscSection, IS);
305 PETSC_EXTERN PetscErrorCode PetscSectionGetDof(PetscSection, PetscInt, PetscInt*);
306 PETSC_EXTERN PetscErrorCode PetscSectionSetDof(PetscSection, PetscInt, PetscInt);
307 PETSC_EXTERN PetscErrorCode PetscSectionAddDof(PetscSection, PetscInt, PetscInt);
308 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldDof(PetscSection, PetscInt, PetscInt, PetscInt*);
309 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldDof(PetscSection, PetscInt, PetscInt, PetscInt);
310 PETSC_EXTERN PetscErrorCode PetscSectionAddFieldDof(PetscSection, PetscInt, PetscInt, PetscInt);
311 PETSC_EXTERN PetscErrorCode PetscSectionHasConstraints(PetscSection, PetscBool *);
312 PETSC_EXTERN PetscErrorCode PetscSectionGetConstraintDof(PetscSection, PetscInt, PetscInt*);
313 PETSC_EXTERN PetscErrorCode PetscSectionSetConstraintDof(PetscSection, PetscInt, PetscInt);
314 PETSC_EXTERN PetscErrorCode PetscSectionAddConstraintDof(PetscSection, PetscInt, PetscInt);
315 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldConstraintDof(PetscSection, PetscInt, PetscInt, PetscInt*);
316 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldConstraintDof(PetscSection, PetscInt, PetscInt, PetscInt);
317 PETSC_EXTERN PetscErrorCode PetscSectionAddFieldConstraintDof(PetscSection, PetscInt, PetscInt, PetscInt);
318 PETSC_EXTERN PetscErrorCode PetscSectionGetConstraintIndices(PetscSection, PetscInt, const PetscInt**);
319 PETSC_EXTERN PetscErrorCode PetscSectionSetConstraintIndices(PetscSection, PetscInt, const PetscInt*);
320 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldConstraintIndices(PetscSection, PetscInt, PetscInt, const PetscInt**);
321 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldConstraintIndices(PetscSection, PetscInt, PetscInt, const PetscInt*);
322 PETSC_EXTERN PetscErrorCode PetscSectionSetUpBC(PetscSection);
323 PETSC_EXTERN PetscErrorCode PetscSectionSetUp(PetscSection);
324 PETSC_EXTERN PetscErrorCode PetscSectionGetMaxDof(PetscSection, PetscInt*);
325 PETSC_EXTERN PetscErrorCode PetscSectionGetStorageSize(PetscSection, PetscInt*);
326 PETSC_EXTERN PetscErrorCode PetscSectionGetConstrainedStorageSize(PetscSection, PetscInt*);
327 PETSC_EXTERN PetscErrorCode PetscSectionGetOffset(PetscSection, PetscInt, PetscInt*);
328 PETSC_EXTERN PetscErrorCode PetscSectionSetOffset(PetscSection, PetscInt, PetscInt);
329 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldOffset(PetscSection, PetscInt, PetscInt, PetscInt*);
330 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldOffset(PetscSection, PetscInt, PetscInt, PetscInt);
331 PETSC_EXTERN PetscErrorCode PetscSectionGetOffsetRange(PetscSection, PetscInt *, PetscInt *);
332 PETSC_EXTERN PetscErrorCode PetscSectionView(PetscSection, PetscViewer);
333 PETSC_STATIC_INLINE PetscErrorCode PetscSectionViewFromOptions(PetscSection A,const char prefix[],const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,prefix,name);}
334 PETSC_EXTERN PetscErrorCode PetscSectionReset(PetscSection);
335 PETSC_EXTERN PetscErrorCode PetscSectionDestroy(PetscSection*);
336 PETSC_EXTERN PetscErrorCode PetscSectionCreateGlobalSection(PetscSection, PetscSF, PetscBool, PetscSection *);
337 PETSC_EXTERN PetscErrorCode PetscSectionCreateGlobalSectionCensored(PetscSection, PetscSF, PetscBool, PetscInt, const PetscInt [], PetscSection *);
338 PETSC_EXTERN PetscErrorCode PetscSectionCreateSubsection(PetscSection, PetscInt, PetscInt [], PetscSection *);
339 PETSC_EXTERN PetscErrorCode PetscSectionCreateSubmeshSection(PetscSection, IS, PetscSection *);
340 PETSC_EXTERN PetscErrorCode PetscSectionGetPointLayout(MPI_Comm, PetscSection, PetscLayout *);
341 PETSC_EXTERN PetscErrorCode PetscSectionGetValueLayout(MPI_Comm, PetscSection, PetscLayout *);
342 PETSC_EXTERN PetscErrorCode PetscSectionPermute(PetscSection, IS, PetscSection *);
343 PETSC_EXTERN PetscErrorCode PetscSectionGetField(PetscSection, PetscInt, PetscSection *);
344 
345 PETSC_EXTERN PetscErrorCode PetscSectionSetClosureIndex(PetscSection, PetscObject, PetscSection, IS);
346 PETSC_EXTERN PetscErrorCode PetscSectionGetClosureIndex(PetscSection, PetscObject, PetscSection *, IS *);
347 
348 /* PetscSF support */
349 PETSC_EXTERN PetscErrorCode PetscSFConvertPartition(PetscSF, PetscSection, IS, ISLocalToGlobalMapping *, PetscSF *);
350 PETSC_EXTERN PetscErrorCode PetscSFCreateRemoteOffsets(PetscSF, PetscSection, PetscSection, PetscInt **);
351 PETSC_EXTERN PetscErrorCode PetscSFDistributeSection(PetscSF, PetscSection, PetscInt **, PetscSection);
352 PETSC_EXTERN PetscErrorCode PetscSFCreateSectionSF(PetscSF, PetscSection, PetscInt [], PetscSection, PetscSF *);
353 
354 /* Reset __FUNCT__ in case the user does not define it themselves */
355 #undef __FUNCT__
356 #define __FUNCT__ "User provided function"
357 
358 #endif
359