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