xref: /petsc/include/petscis.h (revision 8a1af44da4882b8d0246f6cd95069f95e8fe7aba)
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 <petscviewertypes.h>
9 #include <petscsf.h>
10 
11 #define IS_FILE_CLASSID 1211218
12 PETSC_EXTERN PetscClassId IS_CLASSID;
13 
14 PETSC_EXTERN PetscErrorCode ISInitializePackage(void);
15 
16 /*S
17      IS - Abstract PETSc object that allows indexing.
18 
19    Level: beginner
20 
21   Concepts: indexing, stride
22 
23 .seealso:  ISCreateGeneral(), ISCreateBlock(), ISCreateStride(), ISGetIndices(), ISDestroy()
24 S*/
25 typedef struct _p_IS* IS;
26 
27 /*J
28     ISType - String with the name of a PETSc vector or the creation function
29        with an optional dynamic library name, for example
30        http://www.mcs.anl.gov/petsc/lib.a:myveccreate()
31 
32    Level: beginner
33 
34 .seealso: ISSetType(), IS
35 J*/
36 typedef const char* ISType;
37 #define ISGENERAL      "general"
38 #define ISSTRIDE       "stride"
39 #define ISBLOCK        "block"
40 
41 /* Dynamic creation and loading functions */
42 PETSC_EXTERN PetscFunctionList ISList;
43 PETSC_EXTERN PetscBool         ISRegisterAllCalled;
44 PETSC_EXTERN PetscErrorCode ISSetType(IS, ISType);
45 PETSC_EXTERN PetscErrorCode ISGetType(IS, ISType *);
46 PETSC_EXTERN PetscErrorCode ISRegister(const char[],PetscErrorCode (*)(IS));
47 PETSC_EXTERN PetscErrorCode ISRegisterAll(void);
48 PETSC_EXTERN PetscErrorCode ISRegisterDestroy(void);
49 PETSC_EXTERN PetscErrorCode ISCreate(MPI_Comm,IS*);
50 
51 /*
52     Default index set data structures that PETSc provides.
53 */
54 PETSC_EXTERN PetscErrorCode ISCreateGeneral(MPI_Comm,PetscInt,const PetscInt[],PetscCopyMode,IS *);
55 PETSC_EXTERN PetscErrorCode ISGeneralSetIndices(IS,PetscInt,const PetscInt[],PetscCopyMode);
56 PETSC_EXTERN PetscErrorCode ISCreateBlock(MPI_Comm,PetscInt,PetscInt,const PetscInt[],PetscCopyMode,IS *);
57 PETSC_EXTERN PetscErrorCode ISBlockSetIndices(IS,PetscInt,PetscInt,const PetscInt[],PetscCopyMode);
58 PETSC_EXTERN PetscErrorCode ISCreateStride(MPI_Comm,PetscInt,PetscInt,PetscInt,IS *);
59 PETSC_EXTERN PetscErrorCode ISStrideSetStride(IS,PetscInt,PetscInt,PetscInt);
60 
61 PETSC_EXTERN PetscErrorCode ISDestroy(IS*);
62 PETSC_EXTERN PetscErrorCode ISSetPermutation(IS);
63 PETSC_EXTERN PetscErrorCode ISPermutation(IS,PetscBool *);
64 PETSC_EXTERN PetscErrorCode ISSetIdentity(IS);
65 PETSC_EXTERN PetscErrorCode ISIdentity(IS,PetscBool *);
66 PETSC_EXTERN PetscErrorCode ISContiguousLocal(IS,PetscInt,PetscInt,PetscInt*,PetscBool*);
67 
68 PETSC_EXTERN PetscErrorCode ISGetIndices(IS,const PetscInt *[]);
69 PETSC_EXTERN PetscErrorCode ISRestoreIndices(IS,const PetscInt *[]);
70 PETSC_EXTERN PetscErrorCode ISGetTotalIndices(IS,const PetscInt *[]);
71 PETSC_EXTERN PetscErrorCode ISRestoreTotalIndices(IS,const PetscInt *[]);
72 PETSC_EXTERN PetscErrorCode ISGetNonlocalIndices(IS,const PetscInt *[]);
73 PETSC_EXTERN PetscErrorCode ISRestoreNonlocalIndices(IS,const PetscInt *[]);
74 PETSC_EXTERN PetscErrorCode ISGetNonlocalIS(IS, IS *is);
75 PETSC_EXTERN PetscErrorCode ISRestoreNonlocalIS(IS, IS *is);
76 PETSC_EXTERN PetscErrorCode ISGetSize(IS,PetscInt *);
77 PETSC_EXTERN PetscErrorCode ISGetLocalSize(IS,PetscInt *);
78 PETSC_EXTERN PetscErrorCode ISInvertPermutation(IS,PetscInt,IS*);
79 PETSC_EXTERN PetscErrorCode ISView(IS,PetscViewer);
80 PETSC_EXTERN PetscErrorCode ISEqual(IS,IS,PetscBool  *);
81 PETSC_EXTERN PetscErrorCode ISSort(IS);
82 PETSC_EXTERN PetscErrorCode ISSorted(IS,PetscBool  *);
83 PETSC_EXTERN PetscErrorCode ISDifference(IS,IS,IS*);
84 PETSC_EXTERN PetscErrorCode ISSum(IS,IS,IS*);
85 PETSC_EXTERN PetscErrorCode ISExpand(IS,IS,IS*);
86 PETSC_EXTERN PetscErrorCode ISGetMinMax(IS,PetscInt*,PetscInt*);
87 
88 PETSC_EXTERN PetscErrorCode ISBlockGetIndices(IS,const PetscInt *[]);
89 PETSC_EXTERN PetscErrorCode ISBlockRestoreIndices(IS,const PetscInt *[]);
90 PETSC_EXTERN PetscErrorCode ISBlockGetLocalSize(IS,PetscInt *);
91 PETSC_EXTERN PetscErrorCode ISBlockGetSize(IS,PetscInt *);
92 PETSC_EXTERN PetscErrorCode ISGetBlockSize(IS,PetscInt*);
93 PETSC_EXTERN PetscErrorCode ISSetBlockSize(IS,PetscInt);
94 
95 PETSC_EXTERN PetscErrorCode ISStrideGetInfo(IS,PetscInt *,PetscInt*);
96 
97 PETSC_EXTERN PetscErrorCode ISToGeneral(IS);
98 
99 PETSC_EXTERN PetscErrorCode ISDuplicate(IS,IS*);
100 PETSC_EXTERN PetscErrorCode ISCopy(IS,IS);
101 PETSC_EXTERN PetscErrorCode ISAllGather(IS,IS*);
102 PETSC_EXTERN PetscErrorCode ISComplement(IS,PetscInt,PetscInt,IS*);
103 PETSC_EXTERN PetscErrorCode ISConcatenate(MPI_Comm,PetscInt,const IS[],IS*);
104 PETSC_EXTERN PetscErrorCode ISListToPair(MPI_Comm,PetscInt, IS[],IS*,IS*);
105 PETSC_EXTERN PetscErrorCode ISPairToList(IS,IS,PetscInt*, IS *[]);
106 PETSC_EXTERN PetscErrorCode ISEmbed(IS,IS,PetscBool,IS*);
107 PETSC_EXTERN PetscErrorCode ISOnComm(IS,MPI_Comm,PetscCopyMode,IS*);
108 
109 /* --------------------------------------------------------------------------*/
110 PETSC_EXTERN PetscClassId IS_LTOGM_CLASSID;
111 
112 /*S
113    ISLocalToGlobalMapping - mappings from an arbitrary
114       local ordering from 0 to n-1 to a global PETSc ordering
115       used by a vector or matrix.
116 
117    Level: intermediate
118 
119    Note: mapping from Local to Global is scalable; but Global
120   to Local may not be if the range of global values represented locally
121   is very large.
122 
123    Note: the ISLocalToGlobalMapping is actually a private object; it is included
124   here for the inline function ISLocalToGlobalMappingApply() to allow it to be inlined since
125   it is used so often.
126 
127 .seealso:  ISLocalToGlobalMappingCreate()
128 S*/
129 typedef struct _p_ISLocalToGlobalMapping* ISLocalToGlobalMapping;
130 
131 /*E
132     ISGlobalToLocalMappingType - Indicates if missing global indices are
133 
134    IS_GTOLM_MASK - missing global indices are replaced with -1
135    IS_GTOLM_DROP - missing global indices are dropped
136 
137    Level: beginner
138 
139 .seealso: ISGlobalToLocalMappingApply()
140 
141 E*/
142 typedef enum {IS_GTOLM_MASK,IS_GTOLM_DROP} ISGlobalToLocalMappingType;
143 
144 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreate(MPI_Comm,PetscInt,const PetscInt[],PetscCopyMode,ISLocalToGlobalMapping*);
145 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreateIS(IS,ISLocalToGlobalMapping *);
146 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreateSF(PetscSF,PetscInt,ISLocalToGlobalMapping*);
147 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingView(ISLocalToGlobalMapping,PetscViewer);
148 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingDestroy(ISLocalToGlobalMapping*);
149 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApplyIS(ISLocalToGlobalMapping,IS,IS*);
150 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingApply(ISLocalToGlobalMapping,PetscInt,const PetscInt[],PetscInt[]);
151 PETSC_EXTERN PetscErrorCode ISGlobalToLocalMappingApply(ISLocalToGlobalMapping,ISGlobalToLocalMappingType,PetscInt,const PetscInt[],PetscInt*,PetscInt[]);
152 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetSize(ISLocalToGlobalMapping,PetscInt*);
153 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetInfo(ISLocalToGlobalMapping,PetscInt*,PetscInt*[],PetscInt*[],PetscInt**[]);
154 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreInfo(ISLocalToGlobalMapping,PetscInt*,PetscInt*[],PetscInt*[],PetscInt**[]);
155 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingGetIndices(ISLocalToGlobalMapping,const PetscInt**);
156 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingRestoreIndices(ISLocalToGlobalMapping,const PetscInt**);
157 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingBlock(ISLocalToGlobalMapping,PetscInt,ISLocalToGlobalMapping*);
158 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingUnBlock(ISLocalToGlobalMapping,PetscInt,ISLocalToGlobalMapping*);
159 PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingConcatenate(MPI_Comm,PetscInt,const ISLocalToGlobalMapping[],ISLocalToGlobalMapping*);
160 PETSC_EXTERN PetscErrorCode ISG2LMapApply(ISLocalToGlobalMapping,PetscInt,const PetscInt[],PetscInt[]);
161 
162 /* --------------------------------------------------------------------------*/
163 /*E
164     ISColoringType - determines if the coloring is for the entire parallel grid/graph/matrix
165                      or for just the local ghosted portion
166 
167     Level: beginner
168 
169 $   IS_COLORING_GLOBAL - does not include the colors for ghost points, this is used when the function
170 $                        is called synchronously in parallel. This requires generating a "parallel coloring".
171 $   IS_COLORING_GHOSTED - includes colors for ghost points, this is used when the function can be called
172 $                         seperately on individual processes with the ghost points already filled in. Does not
173 $                         require a "parallel coloring", rather each process colors its local + ghost part.
174 $                         Using this can result in much less parallel communication. In the paradigm of
175 $                         DMGetLocalVector() and DMGetGlobalVector() this could be called IS_COLORING_LOCAL
176 
177 .seealso: DMCreateColoring()
178 E*/
179 typedef enum {IS_COLORING_GLOBAL,IS_COLORING_GHOSTED} ISColoringType;
180 PETSC_EXTERN const char *const ISColoringTypes[];
181 typedef unsigned PETSC_IS_COLOR_VALUE_TYPE ISColoringValue;
182 PETSC_EXTERN PetscErrorCode ISAllGatherColors(MPI_Comm,PetscInt,ISColoringValue*,PetscInt*,ISColoringValue*[]);
183 
184 /*S
185      ISColoring - sets of IS's that define a coloring
186               of the underlying indices
187 
188    Level: intermediate
189 
190     Notes:
191         One should not access the *is records below directly because they may not yet
192     have been created. One should use ISColoringGetIS() to make sure they are
193     created when needed.
194 
195     Developer Note: this is not a PetscObject
196 
197 .seealso:  ISColoringCreate(), ISColoringGetIS(), ISColoringView(), ISColoringGetIS()
198 S*/
199 struct _n_ISColoring {
200   PetscInt        refct;
201   PetscInt        n;                /* number of colors */
202   IS              *is;              /* for each color indicates columns */
203   MPI_Comm        comm;
204   ISColoringValue *colors;          /* for each column indicates color */
205   PetscInt        N;                /* number of columns */
206   ISColoringType  ctype;
207 };
208 typedef struct _n_ISColoring* ISColoring;
209 
210 PETSC_EXTERN PetscErrorCode ISColoringCreate(MPI_Comm,PetscInt,PetscInt,const ISColoringValue[],ISColoring*);
211 PETSC_EXTERN PetscErrorCode ISColoringDestroy(ISColoring*);
212 PETSC_EXTERN PetscErrorCode ISColoringView(ISColoring,PetscViewer);
213 PETSC_EXTERN PetscErrorCode ISColoringGetIS(ISColoring,PetscInt*,IS*[]);
214 PETSC_EXTERN PetscErrorCode ISColoringRestoreIS(ISColoring,IS*[]);
215 PETSC_EXTERN PetscErrorCode ISColoringReference(ISColoring);
216 PETSC_EXTERN PetscErrorCode ISColoringSetType(ISColoring,ISColoringType);
217 
218 
219 /* --------------------------------------------------------------------------*/
220 
221 PETSC_EXTERN PetscErrorCode ISPartitioningToNumbering(IS,IS*);
222 PETSC_EXTERN PetscErrorCode ISPartitioningCount(IS,PetscInt,PetscInt[]);
223 
224 PETSC_EXTERN PetscErrorCode ISCompressIndicesGeneral(PetscInt,PetscInt,PetscInt,PetscInt,const IS[],IS[]);
225 PETSC_EXTERN PetscErrorCode ISCompressIndicesSorted(PetscInt,PetscInt,PetscInt,const IS[],IS[]);
226 PETSC_EXTERN PetscErrorCode ISExpandIndicesGeneral(PetscInt,PetscInt,PetscInt,PetscInt,const IS[],IS[]);
227 
228 /*S
229      PetscLayout - defines layout of vectors and matrices across processes (which rows are owned by which processes)
230 
231    Level: developer
232 
233 
234 .seealso:  PetscLayoutCreate(), PetscLayoutDestroy()
235 S*/
236 typedef struct _n_PetscLayout* PetscLayout;
237 struct _n_PetscLayout{
238   MPI_Comm               comm;
239   PetscInt               n,N;         /* local, global vector size */
240   PetscInt               rstart,rend; /* local start, local end + 1 */
241   PetscInt               *range;      /* the offset of each processor */
242   PetscInt               bs;          /* number of elements in each block (generally for multi-component problems) Do NOT multiply above numbers by bs */
243   PetscInt               refcnt;      /* MPI Vecs obtained with VecDuplicate() and from MatGetVecs() reuse map of input object */
244   ISLocalToGlobalMapping mapping;     /* mapping used in Vec/MatSetValuesLocal() */
245   ISLocalToGlobalMapping bmapping;    /* mapping used in Vec/MatSetValuesBlockedLocal() */
246   PetscInt               *trstarts;   /* local start for each thread */
247 };
248 
249 PETSC_EXTERN PetscErrorCode PetscLayoutCreate(MPI_Comm,PetscLayout*);
250 PETSC_EXTERN PetscErrorCode PetscLayoutSetUp(PetscLayout);
251 PETSC_EXTERN PetscErrorCode PetscLayoutDestroy(PetscLayout*);
252 PETSC_EXTERN PetscErrorCode PetscLayoutDuplicate(PetscLayout,PetscLayout*);
253 PETSC_EXTERN PetscErrorCode PetscLayoutReference(PetscLayout,PetscLayout*);
254 PETSC_EXTERN PetscErrorCode PetscLayoutSetLocalSize(PetscLayout,PetscInt);
255 PETSC_EXTERN PetscErrorCode PetscLayoutGetLocalSize(PetscLayout,PetscInt *);
256 PETSC_EXTERN PetscErrorCode PetscLayoutSetSize(PetscLayout,PetscInt);
257 PETSC_EXTERN PetscErrorCode PetscLayoutGetSize(PetscLayout,PetscInt *);
258 PETSC_EXTERN PetscErrorCode PetscLayoutSetBlockSize(PetscLayout,PetscInt);
259 PETSC_EXTERN PetscErrorCode PetscLayoutGetBlockSize(PetscLayout,PetscInt*);
260 PETSC_EXTERN PetscErrorCode PetscLayoutGetRange(PetscLayout,PetscInt *,PetscInt *);
261 PETSC_EXTERN PetscErrorCode PetscLayoutGetRanges(PetscLayout,const PetscInt *[]);
262 PETSC_EXTERN PetscErrorCode PetscLayoutSetISLocalToGlobalMapping(PetscLayout,ISLocalToGlobalMapping);
263 PETSC_EXTERN PetscErrorCode PetscLayoutSetISLocalToGlobalMappingBlock(PetscLayout,ISLocalToGlobalMapping);
264 PETSC_EXTERN PetscErrorCode PetscSFSetGraphLayout(PetscSF,PetscLayout,PetscInt,const PetscInt*,PetscCopyMode,const PetscInt*);
265 
266 #undef __FUNCT__
267 #define __FUNCT__ "PetscLayoutFindOwner"
268 /*@C
269      PetscLayoutFindOwner - Find the owning rank for a global index
270 
271     Not Collective
272 
273    Input Parameters:
274 +    map - the layout
275 -    idx - global index to find the owner of
276 
277    Output Parameter:
278 .    owner - the owning rank
279 
280    Level: developer
281 
282     Fortran Notes:
283       Not available from Fortran
284 
285 @*/
286 PETSC_STATIC_INLINE PetscErrorCode PetscLayoutFindOwner(PetscLayout map,PetscInt idx,PetscInt *owner)
287 {
288   PetscErrorCode ierr;
289   PetscMPIInt    lo = 0,hi,t;
290 
291   PetscFunctionBegin;
292   *owner = -1;                  /* GCC erroneously issues warning about possibly uninitialized use when error condition */
293   if (!((map->n >= 0) && (map->N >= 0) && (map->range))) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"PetscLayoutSetUp() must be called first");
294   if (idx < 0 || idx > map->N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Index %D is out of range",idx);
295   ierr = MPI_Comm_size(map->comm,&hi);CHKERRQ(ierr);
296   while (hi - lo > 1) {
297     t = lo + (hi - lo) / 2;
298     if (idx < map->range[t]) hi = t;
299     else                     lo = t;
300   }
301   *owner = lo;
302   PetscFunctionReturn(0);
303 }
304 
305 #undef __FUNCT__
306 #define __FUNCT__ "PetscLayoutFindOwnerIndex"
307 /*@C
308      PetscLayoutFindOwnerIndex - Find the owning rank and the local index for a global index
309 
310     Not Collective
311 
312    Input Parameters:
313 +    map   - the layout
314 -    idx   - global index to find the owner of
315 
316    Output Parameter:
317 +    owner - the owning rank
318 -    lidx  - local index used by the owner for idx
319 
320    Level: developer
321 
322     Fortran Notes:
323       Not available from Fortran
324 
325 @*/
326 PETSC_STATIC_INLINE PetscErrorCode PetscLayoutFindOwnerIndex(PetscLayout map,PetscInt idx,PetscInt *owner, PetscInt *lidx)
327 {
328   PetscErrorCode ierr;
329   PetscMPIInt    lo = 0,hi,t;
330 
331   PetscFunctionBegin;
332   if (!((map->n >= 0) && (map->N >= 0) && (map->range))) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"PetscLayoutSetUp() must be called first");
333   if (idx < 0 || idx > map->N) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Index %D is out of range",idx);
334   ierr = MPI_Comm_size(map->comm,&hi);CHKERRQ(ierr);
335   while (hi - lo > 1) {
336     t = lo + (hi - lo) / 2;
337     if (idx < map->range[t]) hi = t;
338     else                     lo = t;
339   }
340   *owner = lo;
341   *lidx  = idx-map->range[lo];
342   PetscFunctionReturn(0);
343 }
344 
345 PETSC_EXTERN PetscClassId PETSC_SECTION_CLASSID;
346 
347 /*S
348   PetscSection - Mapping from integers in a designated range to contiguous sets of integers.
349 
350   In contrast to IS, which maps from integers to single integers, the range of a PetscSection is in the space of
351   contiguous sets of integers. These ranges are frequently interpreted as domains of other array-like objects,
352   especially other PetscSections, Vecs, and ISs. The domain is set with PetscSectionSetChart() and does not need to
353   start at 0. For each point in the domain of a PetscSection, the output set is represented through an offset and a
354   count, which are set using PetscSectionSetOffset() and PetscSectionSetDof() respectively. Lookup is typically using
355   accessors or routines like VecGetValuesSection().
356 
357   Level: developer
358 
359 .seealso:  PetscSectionCreate(), PetscSectionDestroy()
360 S*/
361 typedef struct _p_PetscSection *PetscSection;
362 PETSC_EXTERN PetscErrorCode PetscSectionCreate(MPI_Comm,PetscSection*);
363 PETSC_EXTERN PetscErrorCode PetscSectionClone(PetscSection, PetscSection*);
364 PETSC_EXTERN PetscErrorCode PetscSectionGetNumFields(PetscSection, PetscInt *);
365 PETSC_EXTERN PetscErrorCode PetscSectionSetNumFields(PetscSection, PetscInt);
366 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldName(PetscSection, PetscInt, const char *[]);
367 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldName(PetscSection, PetscInt, const char []);
368 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldComponents(PetscSection, PetscInt, PetscInt *);
369 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldComponents(PetscSection, PetscInt, PetscInt);
370 PETSC_EXTERN PetscErrorCode PetscSectionGetChart(PetscSection, PetscInt *, PetscInt *);
371 PETSC_EXTERN PetscErrorCode PetscSectionSetChart(PetscSection, PetscInt, PetscInt);
372 PETSC_EXTERN PetscErrorCode PetscSectionGetDof(PetscSection, PetscInt, PetscInt*);
373 PETSC_EXTERN PetscErrorCode PetscSectionSetDof(PetscSection, PetscInt, PetscInt);
374 PETSC_EXTERN PetscErrorCode PetscSectionAddDof(PetscSection, PetscInt, PetscInt);
375 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldDof(PetscSection, PetscInt, PetscInt, PetscInt*);
376 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldDof(PetscSection, PetscInt, PetscInt, PetscInt);
377 PETSC_EXTERN PetscErrorCode PetscSectionAddFieldDof(PetscSection, PetscInt, PetscInt, PetscInt);
378 PETSC_EXTERN PetscErrorCode PetscSectionGetConstraintDof(PetscSection, PetscInt, PetscInt*);
379 PETSC_EXTERN PetscErrorCode PetscSectionSetConstraintDof(PetscSection, PetscInt, PetscInt);
380 PETSC_EXTERN PetscErrorCode PetscSectionAddConstraintDof(PetscSection, PetscInt, PetscInt);
381 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldConstraintDof(PetscSection, PetscInt, PetscInt, PetscInt*);
382 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldConstraintDof(PetscSection, PetscInt, PetscInt, PetscInt);
383 PETSC_EXTERN PetscErrorCode PetscSectionAddFieldConstraintDof(PetscSection, PetscInt, PetscInt, PetscInt);
384 PETSC_EXTERN PetscErrorCode PetscSectionGetConstraintIndices(PetscSection, PetscInt, const PetscInt**);
385 PETSC_EXTERN PetscErrorCode PetscSectionSetConstraintIndices(PetscSection, PetscInt, const PetscInt*);
386 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldConstraintIndices(PetscSection, PetscInt, PetscInt, const PetscInt**);
387 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldConstraintIndices(PetscSection, PetscInt, PetscInt, const PetscInt*);
388 PETSC_EXTERN PetscErrorCode PetscSectionSetUpBC(PetscSection);
389 PETSC_EXTERN PetscErrorCode PetscSectionSetUp(PetscSection);
390 PETSC_EXTERN PetscErrorCode PetscSectionGetMaxDof(PetscSection, PetscInt*);
391 PETSC_EXTERN PetscErrorCode PetscSectionGetStorageSize(PetscSection, PetscInt*);
392 PETSC_EXTERN PetscErrorCode PetscSectionGetConstrainedStorageSize(PetscSection, PetscInt*);
393 PETSC_EXTERN PetscErrorCode PetscSectionGetOffset(PetscSection, PetscInt, PetscInt*);
394 PETSC_EXTERN PetscErrorCode PetscSectionSetOffset(PetscSection, PetscInt, PetscInt);
395 PETSC_EXTERN PetscErrorCode PetscSectionGetFieldOffset(PetscSection, PetscInt, PetscInt, PetscInt*);
396 PETSC_EXTERN PetscErrorCode PetscSectionSetFieldOffset(PetscSection, PetscInt, PetscInt, PetscInt);
397 PETSC_EXTERN PetscErrorCode PetscSectionGetOffsetRange(PetscSection, PetscInt *, PetscInt *);
398 PETSC_EXTERN PetscErrorCode PetscSectionView(PetscSection, PetscViewer);
399 PETSC_EXTERN PetscErrorCode PetscSectionReset(PetscSection);
400 PETSC_EXTERN PetscErrorCode PetscSectionDestroy(PetscSection*);
401 PETSC_EXTERN PetscErrorCode PetscSectionCreateGlobalSection(PetscSection, PetscSF, PetscBool, PetscSection *);
402 PETSC_EXTERN PetscErrorCode PetscSectionCreateGlobalSectionCensored(PetscSection, PetscSF, PetscBool, PetscInt, const PetscInt [], PetscSection *);
403 PETSC_EXTERN PetscErrorCode PetscSectionCreateSubsection(PetscSection, PetscInt, PetscInt [], PetscSection *);
404 PETSC_EXTERN PetscErrorCode PetscSectionCreateSubmeshSection(PetscSection, IS, PetscSection *);
405 PETSC_EXTERN PetscErrorCode PetscSectionGetPointLayout(MPI_Comm, PetscSection, PetscLayout *);
406 PETSC_EXTERN PetscErrorCode PetscSectionGetValueLayout(MPI_Comm, PetscSection, PetscLayout *);
407 
408 /* PetscSF support */
409 PETSC_EXTERN PetscErrorCode PetscSFConvertPartition(PetscSF, PetscSection, IS, ISLocalToGlobalMapping *, PetscSF *);
410 PETSC_EXTERN PetscErrorCode PetscSFCreateRemoteOffsets(PetscSF, PetscSection, PetscSection, PetscInt **);
411 PETSC_EXTERN PetscErrorCode PetscSFDistributeSection(PetscSF, PetscSection, PetscInt **, PetscSection);
412 PETSC_EXTERN PetscErrorCode PetscSFCreateSectionSF(PetscSF, PetscSection, PetscInt [], PetscSection, PetscSF *);
413 
414 /* Reset __FUNCT__ in case the user does not define it themselves */
415 #undef __FUNCT__
416 #define __FUNCT__ "User provided function"
417 
418 #endif
419