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