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