1a4963045SJacob Faibussowitsch #pragma once 201e13f73SMatthew G. Knepley 3ce78bad3SBarry Smith /* MANSEC = Vec */ 4ac09b921SBarry Smith /* SUBMANSEC = IS */ 5ac09b921SBarry Smith 601e13f73SMatthew G. Knepley /*S 716a05f60SBarry Smith IS - Abstract PETSc object used for efficient indexing into vector and matrices 801e13f73SMatthew G. Knepley 901e13f73SMatthew G. Knepley Level: beginner 1001e13f73SMatthew G. Knepley 1116a05f60SBarry Smith .seealso: `ISType`, `ISCreateGeneral()`, `ISCreateBlock()`, `ISCreateStride()`, `ISGetIndices()`, `ISDestroy()` 1201e13f73SMatthew G. Knepley S*/ 1301e13f73SMatthew G. Knepley typedef struct _p_IS *IS; 1401e13f73SMatthew G. Knepley 1501e13f73SMatthew G. Knepley /*S 1616a05f60SBarry Smith ISLocalToGlobalMapping - mappings from a 1716a05f60SBarry Smith local ordering (on individual MPI processes) of 0 to n-1 to a global PETSc ordering (across collections of MPI processes) 1801e13f73SMatthew G. Knepley used by a vector or matrix. 1901e13f73SMatthew G. Knepley 2001e13f73SMatthew G. Knepley Level: intermediate 2101e13f73SMatthew G. Knepley 2216a05f60SBarry Smith Note: 2387497f52SBarry Smith Mapping from local to global is scalable; but global 24bdaf1daeSBarry Smith to local may not be if the range of global values represented locally 2516a05f60SBarry Smith is very large. `ISLocalToGlobalMappingType` provides alternative ways of efficiently applying `ISGlobalToLocalMappingApply() 2601e13f73SMatthew G. Knepley 2716a05f60SBarry Smith Developer Note: 2887497f52SBarry Smith `ISLocalToGlobalMapping` is actually a private object; it is included 2987497f52SBarry Smith here for the inline function `ISLocalToGlobalMappingApply()` to allow it to be inlined since 3001e13f73SMatthew G. Knepley it is used so often. 3101e13f73SMatthew G. Knepley 3216a05f60SBarry Smith .seealso: `ISLocalToGlobalMappingCreate()`, `ISLocalToGlobalMappingApply()`, `ISLocalToGlobalMappingDestroy()`, `ISGlobalToLocalMappingApply()` 3301e13f73SMatthew G. Knepley S*/ 3401e13f73SMatthew G. Knepley typedef struct _p_ISLocalToGlobalMapping *ISLocalToGlobalMapping; 3501e13f73SMatthew G. Knepley 3601e13f73SMatthew G. Knepley /*S 37af27ebaaSBarry Smith ISColoring - sets of `IS`s that define a coloring of something, such as a graph defined by a sparse matrix 3801e13f73SMatthew G. Knepley 3901e13f73SMatthew G. Knepley Level: intermediate 4001e13f73SMatthew G. Knepley 4101e13f73SMatthew G. Knepley Notes: 4201e13f73SMatthew G. Knepley One should not access the *is records below directly because they may not yet 4387497f52SBarry Smith have been created. One should use `ISColoringGetIS()` to make sure they are 4401e13f73SMatthew G. Knepley created when needed. 4501e13f73SMatthew G. Knepley 4687497f52SBarry Smith When the coloring type is `IS_COLORING_LOCAL` the coloring is in the local ordering of the unknowns. 47bdaf1daeSBarry Smith That is the matching the local (ghosted) vector; a local to global mapping must be applied to map 48bdaf1daeSBarry Smith them to the global ordering. 49bdaf1daeSBarry Smith 5087497f52SBarry Smith Developer Note: 5187497f52SBarry Smith This is not a `PetscObject` 5201e13f73SMatthew G. Knepley 5316a05f60SBarry Smith .seealso: `IS`, `MatColoringCreate()`, `MatColoring`, `ISColoringCreate()`, `ISColoringGetIS()`, `ISColoringView()` 5401e13f73SMatthew G. Knepley S*/ 5501e13f73SMatthew G. Knepley typedef struct _n_ISColoring *ISColoring; 5601e13f73SMatthew G. Knepley 5701e13f73SMatthew G. Knepley /*S 5816a05f60SBarry Smith PetscLayout - defines layout of vectors and matrices (that is the "global" numbering of vector and matrix entries) across MPI processes (which rows are owned by which processes) 5901e13f73SMatthew G. Knepley 6001e13f73SMatthew G. Knepley Level: developer 6101e13f73SMatthew G. Knepley 6216a05f60SBarry Smith Notes: 6316a05f60SBarry Smith PETSc vectors (`Vec`) have a global number associated with each vector entry. The first MPI process that shares the vector owns the first `n0` entries of the vector, 6416a05f60SBarry Smith the second MPI process the next `n1` entries, etc. A `PetscLayout` is a way of managing this information, for example the number of locally owned entries is provided 6516a05f60SBarry Smith by `PetscLayoutGetLocalSize()` and the range of indices for a given MPI process is provided by `PetscLayoutGetRange()`. 6616a05f60SBarry Smith 67*e1b2f275SBarry Smith Before calling `PetscLayoutSetUp()`, one must call either (or both) `PetscLayoutSetSize()` or `PetscLayoutSetLocalSize()`, 68*e1b2f275SBarry Smith 69f826b5fcSPierre Jolivet Each PETSc `Vec` contains a `PetscLayout` object which can be obtained with `VecGetLayout()`. For convenience `Vec` provides an API to access the layout information directly, 7016a05f60SBarry Smith for example with `VecGetLocalSize()` and `VecGetOwnershipRange()`. 7116a05f60SBarry Smith 721cc06b55SBarry Smith Similarly PETSc matrices have layouts, these are discussed in [](ch_matrices). 7316a05f60SBarry Smith 7416a05f60SBarry Smith .seealso: `PetscLayoutCreate()`, `PetscLayoutDestroy()`, `PetscLayoutGetRange()`, `PetscLayoutGetLocalSize()`, `PetscLayoutGetSize()`, 7516a05f60SBarry Smith `PetscLayoutGetBlockSize()`, `PetscLayoutGetRanges()`, `PetscLayoutFindOwner()`, `PetscLayoutFindOwnerIndex()`, 76*e1b2f275SBarry Smith `VecGetLayout()`, `VecGetLocalSize()`, `VecGetOwnershipRange()`, `PetscLayoutSetUp()`, `PetscLayoutSetSize()`, `PetscLayoutSetLocalSize()` 7701e13f73SMatthew G. Knepley S*/ 7801e13f73SMatthew G. Knepley typedef struct _n_PetscLayout *PetscLayout; 79