Date: 2026-07-30T21:13:59+00:00

Actual source code: petscvec.h

      1: /*
      2:     Defines the vector component of PETSc. Vectors generally represent
      3:   degrees of freedom for finite element/finite difference functions
      4:   on a grid. They have more mathematical structure than simple arrays.
      5: */
      6: #pragma once

      8: #include <petscsys.h>
      9: #include <petscsftypes.h>
     10: #include <petscis.h>
     11: #include <petscdevicetypes.h>
     12: #include <petscviewer.h>

     14: /* SUBMANSEC = Vec */

     16: /*S
     17:    Vec - Abstract PETSc vector object. Used for holding solutions and right-hand sides for linear systems, nonlinear systems, and time integrators

     19:    Level: beginner

     21:    Note:
     22:    Internally the actual vector representation is generally a simple array but most PETSc code can work on other representations through this abstraction

     24: .seealso: [](doc_vector), [](ch_vectors), `VecCreate()`, `VecType`, `VecSetType()`
     25: S*/
     26: typedef struct _p_Vec *Vec;

     28: /*E
     29:   ScatterMode - Determines the direction of a scatter in `VecScatterBegin()` and `VecScatterEnd()`

     31:   Values:
     32: +  `SCATTER_FORWARD`       - Scatters the values as dictated by the `VecScatterCreate()` call
     33: .  `SCATTER_REVERSE`       - Moves the values in the opposite direction than the directions indicated in the `VecScatterCreate()` call
     34: .  `SCATTER_FORWARD_LOCAL` - Scatters the values as dictated by the `VecScatterCreate()` call except NO MPI communication is done
     35: -  `SCATTER_REVERSE_LOCAL` - Moves the values in the opposite direction than the directions indicated in the `VecScatterCreate()` call
     36:                              except NO MPI communication is done

     38:   Level: beginner

     40: .seealso: [](ch_vectors), `VecScatter`, `VecScatterBegin()`, `VecScatterEnd()`, `SCATTER_FORWARD`, `SCATTER_REVERSE`, `SCATTER_FORWARD_LOCAL`, `SCATTER_REVERSE_LOCAL`
     41: E*/
     42: typedef enum {
     43:   SCATTER_FORWARD       = 0,
     44:   SCATTER_REVERSE       = 1,
     45:   SCATTER_FORWARD_LOCAL = 2,
     46:   SCATTER_REVERSE_LOCAL = 3
     47: } ScatterMode;

     49: /*MC
     50:     SCATTER_FORWARD - Scatters the values as dictated by the `VecScatterCreate()` call during `VecScatterBegin()` and `VecScatterEnd()`

     52:     Level: beginner

     54: .seealso: [](ch_vectors), `VecScatter`, `ScatterMode`, `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()`, `SCATTER_REVERSE`, `SCATTER_FORWARD_LOCAL`,
     55:           `SCATTER_REVERSE_LOCAL`
     56: M*/

     58: /*MC
     59:     SCATTER_REVERSE - Moves the values in the opposite direction than the directions indicated
     60:                       in the `VecScatterCreate()` during `VecScatterBegin()` and `VecScatterEnd()`

     62:     Level: beginner

     64: .seealso: [](ch_vectors), `VecScatter`, `ScatterMode`, `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()`, `SCATTER_FORWARD`, `SCATTER_FORWARD_LOCAL`,
     65:           `SCATTER_REVERSE_LOCAL`
     66: M*/

     68: /*MC
     69:     SCATTER_FORWARD_LOCAL - Scatters the values as dictated by the `VecScatterCreate()` during `VecScatterBegin()` and `VecScatterEnd()` call except NO parallel communication
     70:                             is done. Any variables that have be moved between processes are ignored

     72:     Level: developer

     74: .seealso: [](ch_vectors), `VecScatter`, `ScatterMode`, `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()`, `SCATTER_REVERSE`, `SCATTER_FORWARD`,
     75:           `SCATTER_REVERSE_LOCAL`
     76: M*/

     78: /*MC
     79:     SCATTER_REVERSE_LOCAL - Moves the values in the opposite direction than the directions indicated
     80:                            in the `VecScatterCreate()`  during `VecScatterBegin()` and `VecScatterEnd()` except NO parallel communication
     81:                            is done. Any variables that have be moved between processes are ignored

     83:     Level: developer

     85: .seealso: [](ch_vectors), `VecScatter`, `ScatterMode`, `VecScatterCreate()`, `VecScatterBegin()`, `VecScatterEnd()`, `SCATTER_FORWARD`, `SCATTER_FORWARD_LOCAL`,
     86:           `SCATTER_REVERSE`
     87: M*/

     89: /*J
     90:    VecType - String with the name of a PETSc vector, `Vec`, type

     92:    Level: beginner

     94: .seealso: [](doc_vector), [](ch_vectors), `VecSetType()`, `Vec`, `VecCreate()`, `VecDestroy()`
     95: J*/
     96: typedef const char *VecType;
     97: #define VECSEQ         "seq"
     98: #define VECMPI         "mpi"
     99: #define VECSTANDARD    "standard" /* seq on one process and mpi on multiple */
    100: #define VECSHARED      "shared"
    101: #define VECSEQVIENNACL "seqviennacl"
    102: #define VECMPIVIENNACL "mpiviennacl"
    103: #define VECVIENNACL    "viennacl" /* seqviennacl on one process and mpiviennacl on multiple */
    104: #define VECSEQCUDA     "seqcuda"
    105: #define VECMPICUDA     "mpicuda"
    106: #define VECCUDA        "cuda" /* seqcuda on one process and mpicuda on multiple */
    107: #define VECSEQHIP      "seqhip"
    108: #define VECMPIHIP      "mpihip"
    109: #define VECHIP         "hip" /* seqhip on one process and mpihip on multiple */
    110: #define VECNEST        "nest"
    111: #define VECSEQKOKKOS   "seqkokkos"
    112: #define VECMPIKOKKOS   "mpikokkos"
    113: #define VECKOKKOS      "kokkos" /* seqkokkos on one process and mpikokkos on multiple */

    115: /* Dynamic creation and loading functions */
    116: PETSC_EXTERN PetscErrorCode VecScatterSetType(VecScatter, VecScatterType);
    117: PETSC_EXTERN PetscErrorCode VecScatterGetType(VecScatter, VecScatterType *);
    118: PETSC_EXTERN PetscErrorCode VecScatterSetFromOptions(VecScatter);
    119: PETSC_EXTERN PetscErrorCode VecScatterRegister(const char[], PetscErrorCode (*)(VecScatter));
    120: PETSC_EXTERN PetscErrorCode VecScatterCreate(Vec, IS, Vec, IS, VecScatter *);

    122: /* Logging support */
    123: #define REAL_FILE_CLASSID 1211213
    124: #define VEC_FILE_CLASSID  1211214
    125: PETSC_EXTERN PetscClassId VEC_CLASSID;
    126: PETSC_EXTERN PetscClassId PETSCSF_CLASSID;

    128: PETSC_EXTERN PetscErrorCode VecInitializePackage(void);
    129: PETSC_EXTERN PetscErrorCode VecFinalizePackage(void);

    131: PETSC_EXTERN PetscErrorCode VecCreate(MPI_Comm, Vec *);
    132: PETSC_EXTERN PetscErrorCode VecCreateFromOptions(MPI_Comm, const char *, PetscInt, PetscInt, PetscInt, Vec *);
    133: PETSC_EXTERN PetscErrorCode VecCreateSeq(MPI_Comm, PetscInt, Vec *);
    134: PETSC_EXTERN PetscErrorCode VecCreateMPI(MPI_Comm, PetscInt, PetscInt, Vec *);
    135: PETSC_EXTERN PetscErrorCode VecCreateSeqWithArray(MPI_Comm, PetscInt, PetscInt, const PetscScalar[], Vec *);
    136: PETSC_EXTERN PetscErrorCode VecCreateMPIWithArray(MPI_Comm, PetscInt, PetscInt, PetscInt, const PetscScalar[], Vec *);
    137: PETSC_EXTERN PetscErrorCode VecCreateShared(MPI_Comm, PetscInt, PetscInt, Vec *);

    139: PETSC_EXTERN PetscErrorCode VecSetFromOptions(Vec);
    140: PETSC_EXTERN PetscErrorCode VecViewFromOptions(Vec, PetscObject, const char[]);

    142: PETSC_EXTERN PetscErrorCode VecSetUp(Vec);
    143: PETSC_EXTERN PetscErrorCode VecDestroy(Vec *);
    144: PETSC_EXTERN PetscErrorCode VecZeroEntries(Vec);
    145: PETSC_EXTERN PetscErrorCode VecSetOptionsPrefix(Vec, const char[]);
    146: PETSC_EXTERN PetscErrorCode VecAppendOptionsPrefix(Vec, const char[]);
    147: PETSC_EXTERN PetscErrorCode VecGetOptionsPrefix(Vec, const char *[]);
    148: PETSC_EXTERN PetscErrorCode VecGetState(Vec, PetscObjectState *);

    150: PETSC_EXTERN PetscErrorCode VecSetSizes(Vec, PetscInt, PetscInt);

    152: PETSC_EXTERN PetscErrorCode VecDotNorm2(Vec, Vec, PetscScalar *, PetscReal *);
    153: PETSC_EXTERN PetscErrorCode VecDot(Vec, Vec, PetscScalar *);
    154: PETSC_EXTERN PetscErrorCode VecDotRealPart(Vec, Vec, PetscReal *);
    155: PETSC_EXTERN PetscErrorCode VecTDot(Vec, Vec, PetscScalar *);
    156: PETSC_EXTERN PetscErrorCode VecMDot(Vec, PetscInt, const Vec[], PetscScalar[]);
    157: PETSC_EXTERN PetscErrorCode VecMTDot(Vec, PetscInt, const Vec[], PetscScalar[]);
    158: PETSC_EXTERN PetscErrorCode VecGetSubVector(Vec, IS, Vec *);
    159: PETSC_EXTERN PetscErrorCode VecRestoreSubVector(Vec, IS, Vec *);
    160: PETSC_EXTERN PetscErrorCode VecConcatenate(PetscInt, const Vec[], Vec *, IS *[]);

    162: /*E
    163:     NormType - determines what type of norm to compute with `VecNorm()`, `VecNormBegin()`/`VecNormEnd()` and `MatNorm()`.

    165:     Values:
    166: +    `NORM_1`         - the one norm, $||v|| = \sum_i | v_i |$. $||A|| = \max_j || A_{*j} ||$, maximum column sum
    167: .    `NORM_2`         - the two norm, $||v|| = sqrt(\sum_i |v_i|^2)$ (vectors only)
    168: .    `NORM_FROBENIUS` - $||A|| = sqrt(\sum_{ij} |A_{ij}|^2)$, same as `NORM_2` for vectors
    169: .    `NORM_INFINITY`  - $||v|| = \max_i |v_i|$. $||A|| = \max_i || A_{i*} ||_1$, maximum row sum
    170: -    `NORM_1_AND_2`   - computes both the 1 and 2 norm of a vector. The values are stored in two adjacent `PetscReal` memory locations

    172:     Level: beginner

    174:     Note:
    175:     The `v` above represents a `Vec` while the `A` represents a `Mat`

    177: .seealso: [](ch_vectors), `Vec`, `Mat`, `VecNorm()`, `VecNormBegin()`, `VecNormEnd()`, `MatNorm()`, `NORM_1`,
    178:           `NORM_2`, `NORM_FROBENIUS`, `NORM_INFINITY`, `NORM_1_AND_2`, `ReductionType`
    179: E*/
    180: typedef enum {
    181:   NORM_1         = 0,
    182:   NORM_2         = 1,
    183:   NORM_FROBENIUS = 2,
    184:   NORM_INFINITY  = 3,
    185:   NORM_1_AND_2   = 4
    186: } NormType;
    187: PETSC_EXTERN const char *const NormTypes[];
    188: #define NORM_MAX NORM_INFINITY

    190: /*MC
    191:    NORM_1 - the one norm, $||v|| = \sum_i | v_i |$. $||A|| = \max_j || A_{*,j} ||$, maximum column sum

    193:    Level: beginner

    195: .seealso: [](ch_vectors), `NormType`, `MatNorm()`, `VecNorm()`, `VecNormBegin()`, `VecNormEnd()`, `NORM_2`, `NORM_FROBENIUS`,
    196:           `NORM_INFINITY`, `NORM_1_AND_2`
    197: M*/

    199: /*MC
    200:    NORM_2 - the two norm, $||v|| = \sqrt{\sum_i |v_i|^2}$ (vectors only)

    202:    Level: beginner

    204: .seealso: [](ch_vectors), `NormType`, `MatNorm()`, `VecNorm()`, `VecNormBegin()`, `VecNormEnd()`, `NORM_1`, `NORM_FROBENIUS`,
    205:           `NORM_INFINITY`, `NORM_1_AND_2`
    206: M*/

    208: /*MC
    209:    NORM_FROBENIUS - $||A|| = \sqrt{\sum_{i,j} |A_{i,j}|^2}$, same as `NORM_2` for vectors

    211:    Level: beginner

    213: .seealso: [](ch_vectors), `NormType`, `MatNorm()`, `VecNorm()`, `VecNormBegin()`, `VecNormEnd()`, `NORM_1`, `NORM_2`,
    214:           `NORM_INFINITY`, `NORM_1_AND_2`
    215: M*/

    217: /*MC
    218:    NORM_INFINITY - $||v|| = \max_i |v_i|$. $||A|| = \max_i || A_{i,*} ||_1$, maximum row sum

    220:    Level: beginner

    222: .seealso: [](ch_vectors), `NormType`, `MatNorm()`, `VecNorm()`, `VecNormBegin()`, `VecNormEnd()`, `NORM_1`, `NORM_2`,
    223:           `NORM_FROBENIUS`, `NORM_1_AND_2`
    224: M*/

    226: /*MC
    227:    NORM_1_AND_2 - computes both the 1 and 2 norm of a vector. The values are stored in two adjacent `PetscReal` memory locations

    229:    Level: beginner

    231: .seealso: [](ch_vectors), `NormType`, `MatNorm()`, `VecNorm()`, `VecNormBegin()`, `VecNormEnd()`, `NORM_1`, `NORM_2`,
    232:           `NORM_FROBENIUS`, `NORM_INFINITY`
    233: M*/

    235: /*MC
    236:    NORM_MAX - see `NORM_INFINITY`

    238:    Level: beginner
    239: M*/

    241: /*E
    242:     ReductionType - determines what type of column reduction (one that is not a type of norm defined in `NormType`) to obtain with `MatGetColumnReductions()`

    244:     Values:
    245: +  `REDUCTION_SUM_REALPART`       - sum of real part of each matrix column
    246: .  `REDUCTION_SUM_IMAGINARYPART`  - sum of imaginary part of each matrix column
    247: .  `REDUCTION_MEAN_REALPART`      - arithmetic mean of real part of each matrix column
    248: -  `REDUCTION_MEAN_IMAGINARYPART` - arithmetic mean of imaginary part of each matrix column

    250:     Level: beginner

    252:     Developer Note:
    253:     The constants defined in `ReductionType` MUST BE DISTINCT from those defined in `NormType`.
    254:     This is because `MatGetColumnReductions()` is used to compute both norms and other types of reductions,
    255:     and the constants defined in both `NormType` and `ReductionType` are used to designate the desired operation.

    257: .seealso: [](ch_vectors), `MatGetColumnReductions()`, `MatGetColumnNorms()`, `NormType`, `REDUCTION_SUM_REALPART`,
    258:           `REDUCTION_SUM_IMAGINARYPART`, `REDUCTION_MEAN_REALPART`, `REDUCTION_MEAN_IMAGINARYPART`
    259: E*/
    260: typedef enum {
    261:   REDUCTION_SUM_REALPART       = 10,
    262:   REDUCTION_MEAN_REALPART      = 11,
    263:   REDUCTION_SUM_IMAGINARYPART  = 12,
    264:   REDUCTION_MEAN_IMAGINARYPART = 13
    265: } ReductionType;

    267: /*E
    268:   VecSignMode - How `VecPointwiseSign()` should handle zero value

    270:   Values:
    271: + `VEC_SIGN_ZERO_TO_ZERO`        - `-0.0` and `0.0` map to `0.0`
    272: . `VEC_SIGN_ZERO_TO_SIGNED_ZERO` - `-0.0` maps to `-0.0` and `0.0` maps to `0.0`
    273: - `VEC_SIGN_ZERO_TO_SIGNED_UNIT` - `-0.0` maps to `-1.0` and `0.0` maps to `1.0`

    275:   Level: advanced

    277: .seealso: [](ch_vectors), `VecPointwiseSign()`
    278: E*/
    279: typedef enum {
    280:   VEC_SIGN_ZERO_TO_ZERO,
    281:   VEC_SIGN_ZERO_TO_SIGNED_ZERO,
    282:   VEC_SIGN_ZERO_TO_SIGNED_UNIT,
    283: } VecSignMode;

    285: /*MC
    286:    REDUCTION_SUM_REALPART - sum of real part of a matrix column to obtain with `MatGetColumnReductions()`

    288:    Level: beginner

    290: .seealso: [](ch_vectors), `ReductionType`, `MatGetColumnReductions()`, `REDUCTION_SUM_IMAGINARYPART`, `REDUCTION_MEAN_REALPART`
    291: M*/

    293: /*MC
    294:    REDUCTION_SUM_IMAGINARYPART - sum of imaginary part of matrix column to obtain with `MatGetColumnReductions()`

    296:    Level: beginner

    298: .seealso: [](ch_vectors), `ReductionType`, `MatGetColumnReductions()`, `REDUCTION_SUM_REALPART`, `REDUCTION_MEAN_IMAGINARYPART`
    299: M*/

    301: /*MC
    302:    REDUCTION_MEAN_REALPART - arithmetic mean of real part of matrix column to obtain with `MatGetColumnReductions()`

    304:    Level: beginner

    306: .seealso: [](ch_vectors), `ReductionType`, `MatGetColumnReductions()`, `REDUCTION_MEAN_IMAGINARYPART`, `REDUCTION_SUM_REALPART`
    307: M*/

    309: /*MC
    310:    REDUCTION_MEAN_IMAGINARYPART - arithmetic mean of imaginary part of matrix column to obtain with `MatGetColumnReductions()`

    312:    Level: beginner

    314: .seealso: [](ch_vectors), `ReductionType`, `MatGetColumnReductions()`, `REDUCTION_MEAN_REALPART`, `REDUCTION_SUM_IMAGINARYPART`
    315: M*/

    317: PETSC_EXTERN PetscErrorCode VecNorm(Vec, NormType, PetscReal *);
    318: PETSC_EXTERN PetscErrorCode VecNormAvailable(Vec, NormType, PetscBool *, PetscReal *);
    319: PETSC_EXTERN PetscErrorCode VecFlag(Vec, PetscInt);
    320: PETSC_EXTERN PetscErrorCode VecNormalize(Vec, PetscReal *);
    321: PETSC_EXTERN PetscErrorCode VecSum(Vec, PetscScalar *);
    322: PETSC_EXTERN PetscErrorCode VecMean(Vec, PetscScalar *);
    323: PETSC_EXTERN PetscErrorCode VecMax(Vec, PetscInt *, PetscReal *);
    324: PETSC_EXTERN PetscErrorCode VecMin(Vec, PetscInt *, PetscReal *);
    325: PETSC_EXTERN PetscErrorCode VecScale(Vec, PetscScalar);
    326: PETSC_EXTERN PetscErrorCode VecCopy(Vec, Vec);
    327: PETSC_EXTERN PetscErrorCode VecSetRandom(Vec, PetscRandom);
    328: PETSC_EXTERN PetscErrorCode VecSetRandomGaussian(Vec, PetscRandom, PetscReal, PetscReal);
    329: PETSC_EXTERN PetscErrorCode VecSet(Vec, PetscScalar);
    330: PETSC_DEPRECATED_FUNCTION(3, 22, 0, "VecFlag()", ) PetscErrorCode VecSetInf(Vec);
    331: PETSC_EXTERN PetscErrorCode VecSwap(Vec, Vec);
    332: PETSC_EXTERN PetscErrorCode VecAXPY(Vec, PetscScalar, Vec);
    333: PETSC_EXTERN PetscErrorCode VecAXPBY(Vec, PetscScalar, PetscScalar, Vec);
    334: PETSC_EXTERN PetscErrorCode VecMAXPY(Vec, PetscInt, const PetscScalar[], Vec[]);
    335: PETSC_EXTERN PetscErrorCode VecMAXPBY(Vec, PetscInt, const PetscScalar[], PetscScalar, Vec[]);
    336: PETSC_EXTERN PetscErrorCode VecAYPX(Vec, PetscScalar, Vec);
    337: PETSC_EXTERN PetscErrorCode VecWAXPY(Vec, PetscScalar, Vec, Vec);
    338: PETSC_EXTERN PetscErrorCode VecAXPBYPCZ(Vec, PetscScalar, PetscScalar, PetscScalar, Vec, Vec);
    339: PETSC_EXTERN PetscErrorCode VecPointwiseMax(Vec, Vec, Vec);
    340: PETSC_EXTERN PetscErrorCode VecPointwiseMaxAbs(Vec, Vec, Vec);
    341: PETSC_EXTERN PetscErrorCode VecPointwiseMin(Vec, Vec, Vec);
    342: PETSC_EXTERN PetscErrorCode VecPointwiseMult(Vec, Vec, Vec);
    343: PETSC_EXTERN PetscErrorCode VecPointwiseDivide(Vec, Vec, Vec);
    344: PETSC_EXTERN PetscErrorCode VecPointwiseSign(Vec, Vec, VecSignMode);
    345: PETSC_EXTERN PetscErrorCode VecMaxPointwiseDivide(Vec, Vec, PetscReal *);
    346: PETSC_EXTERN PetscErrorCode VecShift(Vec, PetscScalar);
    347: PETSC_EXTERN PetscErrorCode VecReciprocal(Vec);
    348: PETSC_EXTERN PetscErrorCode VecPermute(Vec, IS, PetscBool);
    349: PETSC_EXTERN PetscErrorCode VecSqrtAbs(Vec);
    350: PETSC_EXTERN PetscErrorCode VecLog(Vec);
    351: PETSC_EXTERN PetscErrorCode VecExp(Vec);
    352: PETSC_EXTERN PetscErrorCode VecAbs(Vec);
    353: PETSC_EXTERN PetscErrorCode VecDuplicate(Vec, Vec *);
    354: PETSC_EXTERN PetscErrorCode VecDuplicateVecs(Vec, PetscInt, Vec *[]);
    355: PETSC_EXTERN PetscErrorCode VecDestroyVecs(PetscInt, Vec *[]);
    356: PETSC_EXTERN PetscErrorCode VecStrideNormAll(Vec, NormType, PetscReal[]);
    357: PETSC_EXTERN PetscErrorCode VecStrideMaxAll(Vec, PetscInt[], PetscReal[]);
    358: PETSC_EXTERN PetscErrorCode VecStrideMinAll(Vec, PetscInt[], PetscReal[]);
    359: PETSC_EXTERN PetscErrorCode VecStrideScaleAll(Vec, const PetscScalar[]);
    360: PETSC_EXTERN PetscErrorCode VecStrideSumAll(Vec, PetscScalar *);
    361: PETSC_EXTERN PetscErrorCode VecUniqueEntries(Vec, PetscInt *, PetscScalar *[]);

    363: PETSC_EXTERN PetscErrorCode VecStrideNorm(Vec, PetscInt, NormType, PetscReal *);
    364: PETSC_EXTERN PetscErrorCode VecStrideMax(Vec, PetscInt, PetscInt *, PetscReal *);
    365: PETSC_EXTERN PetscErrorCode VecStrideMin(Vec, PetscInt, PetscInt *, PetscReal *);
    366: PETSC_EXTERN PetscErrorCode VecStrideScale(Vec, PetscInt, PetscScalar);
    367: PETSC_EXTERN PetscErrorCode VecStrideSum(Vec, PetscInt, PetscScalar *);
    368: PETSC_EXTERN PetscErrorCode VecStrideSet(Vec, PetscInt, PetscScalar);

    370: PETSC_EXTERN PetscErrorCode VecStrideGather(Vec, PetscInt, Vec, InsertMode);
    371: PETSC_EXTERN PetscErrorCode VecStrideScatter(Vec, PetscInt, Vec, InsertMode);
    372: PETSC_EXTERN PetscErrorCode VecStrideGatherAll(Vec, Vec[], InsertMode);
    373: PETSC_EXTERN PetscErrorCode VecStrideScatterAll(Vec[], Vec, InsertMode);

    375: PETSC_EXTERN PetscErrorCode VecStrideSubSetScatter(Vec, PetscInt, const PetscInt[], const PetscInt[], Vec, InsertMode);
    376: PETSC_EXTERN PetscErrorCode VecStrideSubSetGather(Vec, PetscInt, const PetscInt[], const PetscInt[], Vec, InsertMode);

    378: PETSC_EXTERN PetscErrorCode VecSetValues(Vec, PetscInt, const PetscInt[], const PetscScalar[], InsertMode);
    379: PETSC_EXTERN PetscErrorCode VecGetValues(Vec, PetscInt, const PetscInt[], PetscScalar[]);
    380: PETSC_EXTERN PetscErrorCode VecAssemblyBegin(Vec);
    381: PETSC_EXTERN PetscErrorCode VecAssemblyEnd(Vec);
    382: PETSC_EXTERN PetscErrorCode VecStashSetInitialSize(Vec, PetscInt, PetscInt);
    383: PETSC_EXTERN PetscErrorCode VecStashView(Vec, PetscViewer);
    384: PETSC_EXTERN PetscErrorCode VecStashViewFromOptions(Vec, PetscObject, const char[]);
    385: PETSC_EXTERN PetscErrorCode VecStashGetInfo(Vec, PetscInt *, PetscInt *, PetscInt *, PetscInt *);

    387: PETSC_EXTERN PetscErrorCode VecSetPreallocationCOO(Vec, PetscCount, const PetscInt[]);
    388: PETSC_EXTERN PetscErrorCode VecSetPreallocationCOOLocal(Vec, PetscCount, PetscInt[]);
    389: PETSC_EXTERN PetscErrorCode VecSetValuesCOO(Vec, const PetscScalar[], InsertMode);

    391: /*@C
    392:    VecSetValue - Set a single entry into a PETSc vector, `Vec`.

    394:    Not Collective

    396:    Input Parameters:
    397: +  v     - the vector
    398: .  row   - the row location of the entry
    399: .  value - the value to insert
    400: -  mode  - either `INSERT_VALUES` or `ADD_VALUES`

    402:    Level: beginner

    404:    Notes:
    405:    For efficiency one should use `VecSetValues()` and set several or
    406:    many values simultaneously if possible.

    408:    These values may be cached, so `VecAssemblyBegin()` and `VecAssemblyEnd()`
    409:    MUST be called after all calls to `VecSetValue()` have been completed.

    411:    `VecSetValue()` uses 0-based indices in Python, C, and Fortran

    413: .seealso: [](ch_vectors), `VecSetValues()`, `VecAssemblyBegin()`, `VecAssemblyEnd()`, `VecSetValuesBlockedLocal()`, `VecSetValueLocal()`
    414: @*/
    415: static inline PetscErrorCode VecSetValue(Vec v, PetscInt i, PetscScalar va, InsertMode mode)
    416: {
    417:   return VecSetValues(v, 1, &i, &va, mode);
    418: }

    420: PETSC_EXTERN PetscErrorCode VecSetBlockSize(Vec, PetscInt);
    421: PETSC_EXTERN PetscErrorCode VecGetBlockSize(Vec, PetscInt *);
    422: PETSC_EXTERN PetscErrorCode VecSetValuesBlocked(Vec, PetscInt, const PetscInt[], const PetscScalar[], InsertMode);

    424: /* Dynamic creation and loading functions */
    425: PETSC_EXTERN PetscFunctionList VecList;
    426: PETSC_EXTERN PetscErrorCode    VecSetType(Vec, VecType);
    427: PETSC_EXTERN PetscErrorCode    VecGetType(Vec, VecType *);
    428: PETSC_EXTERN PetscErrorCode    VecRegister(const char[], PetscErrorCode (*)(Vec));
    429: PETSC_EXTERN PetscErrorCode    VecRegisterAll(void);

    431: PETSC_EXTERN PetscErrorCode VecScatterBegin(VecScatter, Vec, Vec, InsertMode, ScatterMode);
    432: PETSC_EXTERN PetscErrorCode VecScatterEnd(VecScatter, Vec, Vec, InsertMode, ScatterMode);
    433: PETSC_EXTERN PetscErrorCode VecScatterDestroy(VecScatter *);
    434: PETSC_EXTERN PetscErrorCode VecScatterSetUp(VecScatter);
    435: PETSC_EXTERN PetscErrorCode VecScatterCopy(VecScatter, VecScatter *);
    436: PETSC_EXTERN PetscErrorCode VecScatterView(VecScatter, PetscViewer);
    437: PETSC_EXTERN PetscErrorCode VecScatterViewFromOptions(VecScatter, PetscObject, const char[]);
    438: PETSC_EXTERN PetscErrorCode VecScatterRemap(VecScatter, PetscInt[], PetscInt[]);
    439: PETSC_EXTERN PetscErrorCode VecScatterGetMerged(VecScatter, PetscBool *);

    441: PETSC_EXTERN PetscErrorCode VecGetArray4d(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ****[]);
    442: PETSC_EXTERN PetscErrorCode VecRestoreArray4d(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ****[]);
    443: PETSC_EXTERN PetscErrorCode VecGetArray3d(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ***[]);
    444: PETSC_EXTERN PetscErrorCode VecRestoreArray3d(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ***[]);
    445: PETSC_EXTERN PetscErrorCode VecGetArray2d(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar **[]);
    446: PETSC_EXTERN PetscErrorCode VecRestoreArray2d(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar **[]);
    447: PETSC_EXTERN PetscErrorCode VecGetArray1d(Vec, PetscInt, PetscInt, PetscScalar *[]);
    448: PETSC_EXTERN PetscErrorCode VecRestoreArray1d(Vec, PetscInt, PetscInt, PetscScalar *[]);

    450: PETSC_EXTERN PetscErrorCode VecGetArray4dWrite(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ****[]);
    451: PETSC_EXTERN PetscErrorCode VecGetArray4dWrite(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ****[]);
    452: PETSC_EXTERN PetscErrorCode VecRestoreArray4dWrite(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ****[]);
    453: PETSC_EXTERN PetscErrorCode VecGetArray3dWrite(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ***[]);
    454: PETSC_EXTERN PetscErrorCode VecRestoreArray3dWrite(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ***[]);
    455: PETSC_EXTERN PetscErrorCode VecGetArray2dWrite(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar **[]);
    456: PETSC_EXTERN PetscErrorCode VecRestoreArray2dWrite(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar **[]);
    457: PETSC_EXTERN PetscErrorCode VecGetArray1dWrite(Vec, PetscInt, PetscInt, PetscScalar *[]);
    458: PETSC_EXTERN PetscErrorCode VecRestoreArray1dWrite(Vec, PetscInt, PetscInt, PetscScalar *[]);

    460: PETSC_EXTERN PetscErrorCode VecGetArray4dRead(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ****[]);
    461: PETSC_EXTERN PetscErrorCode VecRestoreArray4dRead(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ****[]);
    462: PETSC_EXTERN PetscErrorCode VecGetArray3dRead(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ***[]);
    463: PETSC_EXTERN PetscErrorCode VecRestoreArray3dRead(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar ***[]);
    464: PETSC_EXTERN PetscErrorCode VecGetArray2dRead(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar **[]);
    465: PETSC_EXTERN PetscErrorCode VecRestoreArray2dRead(Vec, PetscInt, PetscInt, PetscInt, PetscInt, PetscScalar **[]);
    466: PETSC_EXTERN PetscErrorCode VecGetArray1dRead(Vec, PetscInt, PetscInt, PetscScalar *[]);
    467: PETSC_EXTERN PetscErrorCode VecRestoreArray1dRead(Vec, PetscInt, PetscInt, PetscScalar *[]);

    469: PETSC_EXTERN PetscErrorCode VecPlaceArray(Vec, const PetscScalar[]);
    470: PETSC_EXTERN PetscErrorCode VecResetArray(Vec);
    471: PETSC_EXTERN PetscErrorCode VecReplaceArray(Vec, const PetscScalar[]);

    473: PETSC_EXTERN PetscErrorCode VecGetArrays(const Vec[], PetscInt, PetscScalar **[]);
    474: PETSC_EXTERN PetscErrorCode VecRestoreArrays(const Vec[], PetscInt, PetscScalar **[]);

    476: PETSC_EXTERN PetscErrorCode VecView(Vec, PetscViewer);
    477: PETSC_EXTERN PetscErrorCode VecViewNative(Vec, PetscViewer);
    478: PETSC_EXTERN PetscErrorCode VecEqual(Vec, Vec, PetscBool *);
    479: PETSC_EXTERN PetscErrorCode VecLoad(Vec, PetscViewer);

    481: PETSC_EXTERN PetscErrorCode VecGetSize(Vec, PetscInt *);
    482: PETSC_EXTERN PetscErrorCode VecGetLocalSize(Vec, PetscInt *);
    483: PETSC_EXTERN PetscErrorCode VecGetOwnershipRange(Vec, PetscInt *, PetscInt *);
    484: PETSC_EXTERN PetscErrorCode VecGetOwnershipRanges(Vec, const PetscInt *[]);

    486: PETSC_EXTERN PetscErrorCode VecSetLocalToGlobalMapping(Vec, ISLocalToGlobalMapping);
    487: PETSC_EXTERN PetscErrorCode VecSetValuesLocal(Vec, PetscInt, const PetscInt[], const PetscScalar[], InsertMode);

    489: PETSC_EXTERN PetscErrorCode VecViennaCLGetCLContext(Vec, PETSC_UINTPTR_T *);
    490: PETSC_EXTERN PetscErrorCode VecViennaCLGetCLQueue(Vec, PETSC_UINTPTR_T *);
    491: PETSC_EXTERN PetscErrorCode VecViennaCLGetCLMemRead(Vec, PETSC_UINTPTR_T *);
    492: PETSC_EXTERN PetscErrorCode VecViennaCLGetCLMemWrite(Vec, PETSC_UINTPTR_T *);
    493: PETSC_EXTERN PetscErrorCode VecViennaCLRestoreCLMemWrite(Vec);
    494: PETSC_EXTERN PetscErrorCode VecViennaCLGetCLMem(Vec, PETSC_UINTPTR_T *);
    495: PETSC_EXTERN PetscErrorCode VecViennaCLRestoreCLMem(Vec);

    497: /*@C
    498:    VecSetValueLocal - Set a single entry into a vector using the local numbering of the vector, see `VecSetValuesLocal()`

    500:    Not Collective

    502:    Input Parameters:
    503: +  v     - the vector
    504: .  row   - the local row location of the entry
    505: .  value - the value to insert
    506: -  mode  - either `INSERT_VALUES` or `ADD_VALUES`

    508:    Level: beginner

    510:    Notes:
    511:    For efficiency one should use `VecSetValuesLocal()` and set several or
    512:    many values simultaneously if possible.

    514:    These values may be cached, so `VecAssemblyBegin()` and `VecAssemblyEnd()`
    515:    MUST be called after all calls to `VecSetValueLocal()` have been completed.

    517:    See `VecSetLocalToGlobalMapping()` for how the local numbering is defined

    519:    `VecSetValueLocal()` uses 0-based indices in Fortran as well as in C.

    521: .seealso: [](ch_vectors), `VecSetValuesLocal()`, `VecSetValues()`, `VecAssemblyBegin()`, `VecAssemblyEnd()`, `VecSetValuesBlockedLocal()`, `VecSetValue()`,
    522:           `VecSetLocalToGlobalMapping()`
    523: @*/
    524: static inline PetscErrorCode VecSetValueLocal(Vec v, PetscInt i, PetscScalar va, InsertMode mode)
    525: {
    526:   return VecSetValuesLocal(v, 1, &i, &va, mode);
    527: }

    529: /*MC
    530:    VecCheckAssembled - checks if values have been changed in the vector, by `VecSetValues()` or related routines,  but it has not been assembled

    532:    Synopsis:
    533: #include <petscvec.h>
    534:    VecCheckAssembled(Vec v);

    536:    Not Collective

    538:    Input Parameter:
    539: .  v - the vector to check

    541:    Level: developer

    543:    Note:
    544:    After calls to `VecSetValues()` and related routines one must call `VecAssemblyBegin()` and `VecAssemblyEnd()` before using the vector

    546: .seealso: [](ch_vectors), `Vec`, `VecSetValues()`, `VecAssemblyBegin()`, `VecAssemblyEnd()`, `MatAssemblyBegin()`, `MatAssemblyEnd()`
    547: M*/
    548: #define VecCheckAssembled(v) PetscCheck(v->stash.insertmode == NOT_SET_VALUES, PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Not for unassembled vector, did you call VecAssemblyBegin()/VecAssemblyEnd()?")

    550: PETSC_EXTERN PetscErrorCode VecSetValuesBlockedLocal(Vec, PetscInt, const PetscInt[], const PetscScalar[], InsertMode);
    551: PETSC_EXTERN PetscErrorCode VecGetLocalToGlobalMapping(Vec, ISLocalToGlobalMapping *);

    553: PETSC_EXTERN PetscErrorCode VecDotBegin(Vec, Vec, PetscScalar *);
    554: PETSC_EXTERN PetscErrorCode VecDotEnd(Vec, Vec, PetscScalar *);
    555: PETSC_EXTERN PetscErrorCode VecTDotBegin(Vec, Vec, PetscScalar *);
    556: PETSC_EXTERN PetscErrorCode VecTDotEnd(Vec, Vec, PetscScalar *);
    557: PETSC_EXTERN PetscErrorCode VecNormBegin(Vec, NormType, PetscReal *);
    558: PETSC_EXTERN PetscErrorCode VecNormEnd(Vec, NormType, PetscReal *);
    559: PETSC_EXTERN PetscErrorCode VecErrorWeightedNorms(Vec, Vec, Vec, NormType, PetscReal, Vec, PetscReal, Vec, PetscReal, PetscReal *, PetscInt *, PetscReal *, PetscInt *, PetscReal *, PetscInt *);

    561: PETSC_EXTERN PetscErrorCode VecMDotBegin(Vec, PetscInt, const Vec[], PetscScalar[]);
    562: PETSC_EXTERN PetscErrorCode VecMDotEnd(Vec, PetscInt, const Vec[], PetscScalar[]);
    563: PETSC_EXTERN PetscErrorCode VecMTDotBegin(Vec, PetscInt, const Vec[], PetscScalar[]);
    564: PETSC_EXTERN PetscErrorCode VecMTDotEnd(Vec, PetscInt, const Vec[], PetscScalar[]);
    565: PETSC_EXTERN PetscErrorCode PetscCommSplitReductionBegin(MPI_Comm);

    567: PETSC_EXTERN PetscErrorCode VecBindToCPU(Vec, PetscBool);
    568: PETSC_DEPRECATED_FUNCTION(3, 13, 0, "VecBindToCPU()", ) static inline PetscErrorCode VecPinToCPU(Vec v, PetscBool flg)
    569: {
    570:   return VecBindToCPU(v, flg);
    571: }
    572: PETSC_EXTERN PetscErrorCode VecBoundToCPU(Vec, PetscBool *);
    573: PETSC_EXTERN PetscErrorCode VecSetBindingPropagates(Vec, PetscBool);
    574: PETSC_EXTERN PetscErrorCode VecGetBindingPropagates(Vec, PetscBool *);
    575: PETSC_EXTERN PetscErrorCode VecSetPinnedMemoryMin(Vec, size_t);
    576: PETSC_EXTERN PetscErrorCode VecGetPinnedMemoryMin(Vec, size_t *);

    578: PETSC_EXTERN PetscErrorCode VecGetOffloadMask(Vec, PetscOffloadMask *);

    580: /*E
    581:    VecOption - Options that may be set for a vector regarding entries passed to `VecSetValues()` and related routines

    583:    Values:
    584: +   `VEC_IGNORE_OFF_PROC_ENTRIES` - causes `VecSetValues()` to ignore entries destined to be stored on a separate processor.
    585:                                     This can be used to eliminate the global reduction in `VecAssemblyBegin()` if you know that
    586:                                     you have only used `VecSetValues()` to set local elements
    587: .   `VEC_IGNORE_NEGATIVE_INDICES` - means you can pass negative indices in `ix` in calls to `VecSetValues()` or `VecGetValues()`.
    588:                                     These rows are simply ignored.
    589: -   `VEC_SUBSET_OFF_PROC_ENTRIES` - causes `VecAssemblyBegin()` to assume that the off-process entries will always be a subset
    590:                                     (possibly equal) of the off-process entries set on the first assembly which had a true
    591:                                     `VEC_SUBSET_OFF_PROC_ENTRIES` and the vector has not changed this flag afterwards. If this
    592:                                     assembly is not such first assembly, then this assembly can reuse the communication pattern
    593:                                     setup in that first assembly, thus avoiding a global reduction. Subsequent assemblies setting
    594:                                     off-process values should use the same `InsertMode` as the first assembly.

    596:    Level: beginner

    598: .seealso: [](ch_matrices), `Vec`, `MatSetOption()`, `VecSetOption()`, `VecSetValues()`, `VecAssemblyBegin()`
    599: E*/
    600: typedef enum {
    601:   VEC_IGNORE_OFF_PROC_ENTRIES,
    602:   VEC_IGNORE_NEGATIVE_INDICES,
    603:   VEC_SUBSET_OFF_PROC_ENTRIES
    604: } VecOption;

    606: PETSC_EXTERN PetscErrorCode VecSetOption(Vec, VecOption, PetscBool);

    608: PETSC_EXTERN PetscErrorCode VecGetArray(Vec, PetscScalar *[]);
    609: PETSC_EXTERN PetscErrorCode VecGetArrayWrite(Vec, PetscScalar *[]);
    610: PETSC_EXTERN PetscErrorCode VecGetArrayRead(Vec, const PetscScalar *[]);
    611: PETSC_EXTERN PetscErrorCode VecRestoreArray(Vec, PetscScalar *[]);
    612: PETSC_EXTERN PetscErrorCode VecRestoreArrayWrite(Vec, PetscScalar *[]);
    613: PETSC_EXTERN PetscErrorCode VecRestoreArrayRead(Vec, const PetscScalar *[]);
    614: PETSC_EXTERN PetscErrorCode VecCreateLocalVector(Vec, Vec *);
    615: PETSC_EXTERN PetscErrorCode VecGetLocalVector(Vec, Vec);
    616: PETSC_EXTERN PetscErrorCode VecRestoreLocalVector(Vec, Vec);
    617: PETSC_EXTERN PetscErrorCode VecGetLocalVectorRead(Vec, Vec);
    618: PETSC_EXTERN PetscErrorCode VecRestoreLocalVectorRead(Vec, Vec);
    619: PETSC_EXTERN PetscErrorCode VecGetArrayAndMemType(Vec, PetscScalar *[], PetscMemType *);
    620: PETSC_EXTERN PetscErrorCode VecRestoreArrayAndMemType(Vec, PetscScalar *[]);
    621: PETSC_EXTERN PetscErrorCode VecGetArrayReadAndMemType(Vec, const PetscScalar *[], PetscMemType *);
    622: PETSC_EXTERN PetscErrorCode VecRestoreArrayReadAndMemType(Vec, const PetscScalar *[]);
    623: PETSC_EXTERN PetscErrorCode VecGetArrayWriteAndMemType(Vec, PetscScalar *[], PetscMemType *);
    624: PETSC_EXTERN PetscErrorCode VecRestoreArrayWriteAndMemType(Vec, PetscScalar *[]);

    626: /*@C
    627:    VecGetArrayPair - Accesses a pair of pointers for two vectors that may be common. When the vectors are not the same the first pointer is read only

    629:    Logically Collective; No Fortran Support

    631:    Input Parameters:
    632: +  x - the vector
    633: -  y - the second vector

    635:    Output Parameters:
    636: +  xv - location to put pointer to the first array
    637: -  yv - location to put pointer to the second array

    639:    Level: developer

    641: .seealso: [](ch_vectors), `VecGetArray()`, `VecGetArrayRead()`, `VecRestoreArrayPair()`
    642: @*/
    643: static inline PetscErrorCode VecGetArrayPair(Vec x, Vec y, PetscScalar *xv[], PetscScalar *yv[])
    644: {
    645:   PetscFunctionBegin;
    646:   PetscCall(VecGetArray(y, yv));
    647:   if (x == y) *xv = *yv;
    648:   else PetscCall(VecGetArrayRead(x, (const PetscScalar **)xv));
    649:   PetscFunctionReturn(PETSC_SUCCESS);
    650: }

    652: /*@C
    653:    VecRestoreArrayPair - Returns a pair of pointers for two vectors that may be common obtained with `VecGetArrayPair()`

    655:    Logically Collective; No Fortran Support

    657:    Input Parameters:
    658: +  x  - the vector
    659: .  y  - the second vector
    660: .  xv - location to put pointer to the first array
    661: -  yv - location to put pointer to the second array

    663:    Level: developer

    665: .seealso: [](ch_vectors), `VecGetArray()`, `VecGetArrayRead()`, `VecGetArrayPair()`
    666: @*/
    667: static inline PetscErrorCode VecRestoreArrayPair(Vec x, Vec y, PetscScalar *xv[], PetscScalar *yv[])
    668: {
    669:   PetscFunctionBegin;
    670:   PetscCall(VecRestoreArray(y, yv));
    671:   if (x != y) PetscCall(VecRestoreArrayRead(x, (const PetscScalar **)xv));
    672:   PetscFunctionReturn(PETSC_SUCCESS);
    673: }

    675: PETSC_EXTERN PetscErrorCode VecLockReadPush(Vec);
    676: PETSC_EXTERN PetscErrorCode VecLockReadPop(Vec);
    677: PETSC_EXTERN PetscErrorCode VecLockWriteSet(Vec, PetscBool);
    678: PETSC_EXTERN PetscErrorCode VecLockGet(Vec, PetscInt *);
    679: PETSC_EXTERN PetscErrorCode VecLockGetLocation(Vec, const char *[], const char *[], int *);

    681: /*@
    682:   VecSetErrorIfLocked - Raise an error if the `Vec` is currently locked for read or write access.

    684:   Not Collective; No Fortran Support

    686:   Input Parameters:
    687: + x   - the `Vec` to test
    688: - arg - the argument position of `x` in the calling routine, used in the error message

    690:   Level: developer

    692:   Note:
    693:   This is intended as an internal check for routines that must have exclusive access to a `Vec`.
    694:   A locked `Vec` typically indicates that another routine currently holds a read or write reference to it.

    696: .seealso: `Vec`, `VecLockGet()`, `VecLockGetLocation()`, `VecLockReadPush()`, `VecLockReadPop()`, `VecLockWriteSet()`
    697: @*/
    698: static inline PetscErrorCode VecSetErrorIfLocked(Vec x, PetscInt arg)
    699: {
    700:   PetscInt state;

    702:   PetscFunctionBegin;
    703:   PetscCall(VecLockGet(x, &state));
    704:   if (PetscUnlikely(state != 0)) {
    705:     const char *file, *func, *name;
    706:     int         line;

    708:     PetscCall(VecLockGetLocation(x, &file, &func, &line));
    709:     PetscCall(PetscObjectGetName((PetscObject)x, &name));
    710:     SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Vector '%s' (argument #%" PetscInt_FMT ") was locked for %s access in %s() at %s:%d (line numbers only accurate to function begin)", name, arg, state > 0 ? "read-only" : "write-only", func ? func : "unknown_function", file ? file : "unknown file", line);
    711:   }
    712:   PetscFunctionReturn(PETSC_SUCCESS);
    713: }

    715: /* The three are deprecated */
    716: PETSC_DEPRECATED_FUNCTION(3, 11, 0, "VecLockReadPush()", ) static inline PetscErrorCode VecLockPush(Vec v)
    717: {
    718:   return VecLockReadPush(v);
    719: }

    721: PETSC_DEPRECATED_FUNCTION(3, 11, 0, "VecLockReadPop()", ) static inline PetscErrorCode VecLockPop(Vec v)
    722: {
    723:   return VecLockReadPop(v);
    724: }

    726: /*MC
    727:   VecLocked - Deprecated alias for `VecSetErrorIfLocked()`; raises an error if the `Vec` is currently locked for read

    729:   Synopsis:
    730: #include <petscvec.h>
    731:   PetscErrorCode VecLocked(Vec x, int arg)

    733:   Not Collective; No Fortran Support

    735:   Input Parameters:
    736: + x   - the `Vec` to test
    737: - arg - the argument position of `x` in the caller (used in the error message)

    739:   Level: deprecated

    741:   Note:
    742:   Use `VecSetErrorIfLocked()` in new code; this macro is retained only for backwards compatibility.

    744: .seealso: `Vec`, `VecSetErrorIfLocked()`, `VecLockReadPush()`, `VecLockReadPop()`
    745: M*/
    746: #define VecLocked(x, arg) VecSetErrorIfLocked(x, arg) PETSC_DEPRECATED_MACRO(3, 11, 0, "VecSetErrorIfLocked()", )

    748: /*E
    749:   VecOperation - Enumeration of overide-able methods in the `Vec` implementation function-table.

    751:   Values:
    752: + `VECOP_DUPLICATE`  - `VecDuplicate()`
    753: . `VECOP_SET`        - `VecSet()`
    754: . `VECOP_VIEW`       - `VecView()`
    755: . `VECOP_LOAD`       - `VecLoad()`
    756: . `VECOP_VIEWNATIVE` - `VecViewNative()`
    757: - `VECOP_LOADNATIVE` - `VecLoadNative()`

    759:   Level: advanced

    761:   Notes:
    762:   Some operations may serve as the implementation for other routines not listed above. For
    763:   example `VECOP_SET` can be used to simultaneously overriding the implementation used in
    764:   `VecSet()`, `VecSetInf()`, and `VecZeroEntries()`.

    766:   Entries to `VecOperation` are added as needed so if you do not see the operation listed which
    767:   you'd like to replace, please send mail to `petsc-maint@mcs.anl.gov`!

    769: .seealso: [](ch_vectors), `Vec`, `VecSetOperation()`
    770: E*/
    771: typedef enum {
    772:   VECOP_DUPLICATE  = 0,
    773:   VECOP_SET        = 10,
    774:   VECOP_VIEW       = 33,
    775:   VECOP_LOAD       = 41,
    776:   VECOP_VIEWNATIVE = 68,
    777:   VECOP_LOADNATIVE = 69
    778: } VecOperation;
    779: PETSC_EXTERN PetscErrorCode VecSetOperation(Vec, VecOperation, PetscErrorCodeFn *);

    781: /*
    782:      Routines for dealing with ghosted vectors:
    783:   vectors with ghost elements at the end of the array.
    784: */
    785: PETSC_EXTERN PetscErrorCode VecMPISetGhost(Vec, PetscInt, const PetscInt[]);
    786: PETSC_EXTERN PetscErrorCode VecCreateGhost(MPI_Comm, PetscInt, PetscInt, PetscInt, const PetscInt[], Vec *);
    787: PETSC_EXTERN PetscErrorCode VecCreateGhostWithArray(MPI_Comm, PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscScalar[], Vec *);
    788: PETSC_EXTERN PetscErrorCode VecCreateGhostBlock(MPI_Comm, PetscInt, PetscInt, PetscInt, PetscInt, const PetscInt[], Vec *);
    789: PETSC_EXTERN PetscErrorCode VecCreateGhostBlockWithArray(MPI_Comm, PetscInt, PetscInt, PetscInt, PetscInt, const PetscInt[], const PetscScalar[], Vec *);
    790: PETSC_EXTERN PetscErrorCode VecGhostGetGhostIS(Vec, IS *);
    791: PETSC_EXTERN PetscErrorCode VecGhostGetLocalForm(Vec, Vec *);
    792: PETSC_EXTERN PetscErrorCode VecGhostRestoreLocalForm(Vec, Vec *);
    793: PETSC_EXTERN PetscErrorCode VecGhostIsLocalForm(Vec, Vec, PetscBool *);
    794: PETSC_EXTERN PetscErrorCode VecGhostUpdateBegin(Vec, InsertMode, ScatterMode);
    795: PETSC_EXTERN PetscErrorCode VecGhostUpdateEnd(Vec, InsertMode, ScatterMode);

    797: PETSC_EXTERN PetscErrorCode VecConjugate(Vec);
    798: PETSC_EXTERN PetscErrorCode VecImaginaryPart(Vec);
    799: PETSC_EXTERN PetscErrorCode VecRealPart(Vec);

    801: PETSC_EXTERN PetscErrorCode VecScatterCreateToAll(Vec, VecScatter *, Vec *);
    802: PETSC_EXTERN PetscErrorCode VecScatterCreateToZero(Vec, VecScatter *, Vec *);

    804: /* These vector calls were included from TAO. They miss vtable entries and GPU implementation */
    805: PETSC_EXTERN PetscErrorCode ISComplementVec(IS, Vec, IS *);
    806: PETSC_EXTERN PetscErrorCode VecPow(Vec, PetscScalar);
    807: PETSC_EXTERN PetscErrorCode VecMedian(Vec, Vec, Vec, Vec);
    808: PETSC_EXTERN PetscErrorCode VecWhichInactive(Vec, Vec, Vec, Vec, PetscBool, IS *);
    809: PETSC_EXTERN PetscErrorCode VecWhichBetween(Vec, Vec, Vec, IS *);
    810: PETSC_EXTERN PetscErrorCode VecWhichBetweenOrEqual(Vec, Vec, Vec, IS *);
    811: PETSC_EXTERN PetscErrorCode VecWhichGreaterThan(Vec, Vec, IS *);
    812: PETSC_EXTERN PetscErrorCode VecWhichLessThan(Vec, Vec, IS *);
    813: PETSC_EXTERN PetscErrorCode VecWhichEqual(Vec, Vec, IS *);
    814: PETSC_EXTERN PetscErrorCode VecISAXPY(Vec, IS, PetscScalar, Vec);
    815: PETSC_EXTERN PetscErrorCode VecISCopy(Vec, IS, ScatterMode, Vec);
    816: PETSC_EXTERN PetscErrorCode VecISSet(Vec, IS, PetscScalar);
    817: PETSC_EXTERN PetscErrorCode VecISShift(Vec, IS, PetscScalar);
    818: PETSC_EXTERN PetscErrorCode VecBoundGradientProjection(Vec, Vec, Vec, Vec, Vec);
    819: PETSC_EXTERN PetscErrorCode VecStepBoundInfo(Vec, Vec, Vec, Vec, PetscReal *, PetscReal *, PetscReal *);
    820: PETSC_EXTERN PetscErrorCode VecStepMax(Vec, Vec, PetscReal *);
    821: PETSC_EXTERN PetscErrorCode VecStepMaxBounded(Vec, Vec, Vec, Vec, PetscReal *);

    823: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetVector(PetscViewer, Vec);
    824: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaPutVector(PetscViewer, Vec);

    826: struct _n_Vecs {
    827:   PetscInt n;
    828:   Vec      v;
    829: };
    830: /*S
    831:   Vecs - Collection of `Vec`s where the storage for the vectors is held in a single contiguous block of memory

    833:   Level: advanced

    835:   Notes:
    836:   Temporary construct for handling multiple right-hand side solves.

    838:   This is faked by storing a single `Vec` whose array is sized to hold `n` vectors back to back.

    840: .seealso: `Vec`, `VecsCreateSeq()`, `VecsCreateSeqWithArray()`, `VecsDuplicate()`, `VecsDestroy()`
    841: S*/
    842: typedef struct _n_Vecs     *Vecs;
    843: PETSC_EXTERN PetscErrorCode VecsDestroy(Vecs);
    844: PETSC_EXTERN PetscErrorCode VecsCreateSeq(MPI_Comm, PetscInt, PetscInt, Vecs *);
    845: PETSC_EXTERN PetscErrorCode VecsCreateSeqWithArray(MPI_Comm, PetscInt, PetscInt, PetscScalar *, Vecs *);
    846: PETSC_EXTERN PetscErrorCode VecsDuplicate(Vecs, Vecs *);

    848: #if PetscDefined(HAVE_VIENNACL)
    849: /*S
    850:   PetscViennaCLIndices - Opaque handle to an index buffer used by PETSc's ViennaCL `VECVIENNACL` vector backend to perform partial scatters between CPU and GPU memory

    852:   Level: developer

    854: .seealso: `Vec`, `VECVIENNACL`, `VecCreateSeqViennaCL()`, `VecCreateMPIViennaCL()`, `VecViennaCLCopyToGPUSome_Public()`, `VecViennaCLCopyFromGPUSome_Public()`
    855: S*/
    856: typedef struct _p_PetscViennaCLIndices *PetscViennaCLIndices;
    857: PETSC_EXTERN PetscErrorCode             VecViennaCLCopyToGPUSome_Public(Vec, PetscViennaCLIndices);
    858: PETSC_EXTERN PetscErrorCode             VecViennaCLCopyFromGPUSome_Public(Vec, PetscViennaCLIndices);
    859: PETSC_EXTERN PetscErrorCode             VecCreateSeqViennaCL(MPI_Comm, PetscInt, Vec *);
    860: PETSC_EXTERN PetscErrorCode             VecCreateMPIViennaCL(MPI_Comm, PetscInt, PetscInt, Vec *);
    861: #endif
    862: #if PetscDefined(HAVE_CUDA) || PetscDefined(HAVE_HIP)
    863: PETSC_EXTERN PetscErrorCode VecScatterInitializeForGPU(VecScatter, Vec);
    864: PETSC_EXTERN PetscErrorCode VecScatterFinalizeForGPU(VecScatter);
    865: #endif
    866: #if PetscDefined(HAVE_KOKKOS_KERNELS)
    867: PETSC_EXTERN PetscErrorCode VecCreateSeqKokkos(MPI_Comm, PetscInt, Vec *);
    868: PETSC_EXTERN PetscErrorCode VecCreateSeqKokkosWithArray(MPI_Comm, PetscInt, PetscInt, const PetscScalar *, Vec *);
    869: PETSC_EXTERN PetscErrorCode VecCreateMPIKokkos(MPI_Comm, PetscInt, PetscInt, Vec *);
    870: PETSC_EXTERN PetscErrorCode VecCreateMPIKokkosWithArray(MPI_Comm, PetscInt, PetscInt, PetscInt, const PetscScalar *, Vec *);
    871: PETSC_EXTERN PetscErrorCode VecKokkosPlaceArray(Vec, PetscScalar *);
    872: PETSC_EXTERN PetscErrorCode VecKokkosResetArray(Vec);
    873: #endif

    875: PETSC_EXTERN PetscErrorCode VecNestGetSubVecs(Vec, PetscInt *, Vec *[]);
    876: PETSC_EXTERN PetscErrorCode VecNestGetSubVecsRead(Vec, PetscInt *, Vec *[]);
    877: PETSC_EXTERN PetscErrorCode VecNestRestoreSubVecsRead(Vec, PetscInt *, Vec *[]);
    878: PETSC_EXTERN PetscErrorCode VecNestGetSubVec(Vec, PetscInt, Vec *);
    879: PETSC_EXTERN PetscErrorCode VecNestSetSubVecs(Vec, PetscInt, PetscInt *, Vec *);
    880: PETSC_EXTERN PetscErrorCode VecNestSetSubVec(Vec, PetscInt, Vec);
    881: PETSC_EXTERN PetscErrorCode VecCreateNest(MPI_Comm, PetscInt, IS *, Vec *, Vec *);
    882: PETSC_EXTERN PetscErrorCode VecNestGetSize(Vec, PetscInt *);

    884: PETSC_EXTERN PetscErrorCode PetscOptionsGetVec(PetscOptions, const char[], const char[], Vec, PetscBool *);
    885: PETSC_EXTERN PetscErrorCode VecFilter(Vec, PetscReal);
    886: PETSC_DEPRECATED_FUNCTION(3, 20, 0, "VecFilter()", ) static inline PetscErrorCode VecChop(Vec v, PetscReal tol)
    887: {
    888:   return VecFilter(v, tol);
    889: }

    891: PETSC_EXTERN PetscErrorCode VecGetLayout(Vec, PetscLayout *);
    892: PETSC_EXTERN PetscErrorCode VecSetLayout(Vec, PetscLayout);

    894: PETSC_EXTERN PetscErrorCode PetscSectionVecView(PetscSection, Vec, PetscViewer);
    895: PETSC_EXTERN PetscErrorCode VecGetValuesSection(Vec, PetscSection, PetscInt, PetscScalar *[]);
    896: PETSC_EXTERN PetscErrorCode VecSetValuesSection(Vec, PetscSection, PetscInt, const PetscScalar[], InsertMode);
    897: PETSC_EXTERN PetscErrorCode PetscSectionVecNorm(PetscSection, PetscSection, Vec, NormType, PetscReal[]);

    899: /*S
    900:   VecTagger - Object used to manage the tagging of a subset of indices based on the values of a vector.  The
    901:               motivating application is the selection of cells for refinement or coarsening based on vector containing
    902:               the values in an error indicator metric.

    904:   Values:
    905: +  `VECTAGGERABSOLUTE` - "absolute" values are in a interval (box for complex values) of explicitly defined values
    906: .  `VECTAGGERRELATIVE` - "relative" values are in a interval (box for complex values) of values relative to the set of all values in the vector
    907: .  `VECTAGGERCDF`      - "cdf" values are in a relative range of the *cumulative distribution* of values in the vector
    908: .  `VECTAGGEROR`       - "or" values are in the union of other tags
    909: -  `VECTAGGERAND`      - "and" values are in the intersection of other tags

    911:   Level: advanced

    913:   Developer Note:
    914:   Why not use a `DMLabel` or similar object

    916: .seealso: [](ch_vectors), `Vec`, `VecTaggerType`, `VecTaggerCreate()`
    917: S*/
    918: typedef struct _p_VecTagger *VecTagger;

    920: /*J
    921:   VecTaggerType - String with the name of a `VecTagger` type

    923:   Level: advanced

    925: .seealso: [](ch_vectors), `Vec`, `VecTagger`, `VecTaggerCreate()`
    926: J*/
    927: typedef const char *VecTaggerType;
    928: #define VECTAGGERABSOLUTE "absolute"
    929: #define VECTAGGERRELATIVE "relative"
    930: #define VECTAGGERCDF      "cdf"
    931: #define VECTAGGEROR       "or"
    932: #define VECTAGGERAND      "and"

    934: PETSC_EXTERN PetscClassId      VEC_TAGGER_CLASSID;
    935: PETSC_EXTERN PetscFunctionList VecTaggerList;
    936: PETSC_EXTERN PetscErrorCode    VecTaggerRegister(const char[], PetscErrorCode (*)(VecTagger));
    937: PETSC_EXTERN PetscErrorCode    VecTaggerRegisterAll(void);

    939: PETSC_EXTERN PetscErrorCode VecTaggerCreate(MPI_Comm, VecTagger *);
    940: PETSC_EXTERN PetscErrorCode VecTaggerSetBlockSize(VecTagger, PetscInt);
    941: PETSC_EXTERN PetscErrorCode VecTaggerGetBlockSize(VecTagger, PetscInt *);
    942: PETSC_EXTERN PetscErrorCode VecTaggerSetType(VecTagger, VecTaggerType);
    943: PETSC_EXTERN PetscErrorCode VecTaggerGetType(VecTagger, VecTaggerType *);
    944: PETSC_EXTERN PetscErrorCode VecTaggerSetInvert(VecTagger, PetscBool);
    945: PETSC_EXTERN PetscErrorCode VecTaggerGetInvert(VecTagger, PetscBool *);
    946: PETSC_EXTERN PetscErrorCode VecTaggerSetFromOptions(VecTagger);
    947: PETSC_EXTERN PetscErrorCode VecTaggerSetUp(VecTagger);
    948: PETSC_EXTERN PetscErrorCode VecTaggerView(VecTagger, PetscViewer);
    949: PETSC_EXTERN PetscErrorCode VecTaggerComputeIS(VecTagger, Vec, IS *, PetscBool *);
    950: PETSC_EXTERN PetscErrorCode VecTaggerDestroy(VecTagger *);

    952: /*S
    953:    VecTaggerBox - A interval (box for complex numbers) range used to tag values.  For real scalars, this is just a closed interval; for complex scalars,
    954:    the box is the closed region in the complex plane such that real(min) <= real(z) <= real(max) and imag(min) <= imag(z) <= imag(max).  `INF` is an acceptable endpoint.

    956:    Level: beginner

    958: .seealso: [](ch_vectors), `Vec`, `VecTagger`, `VecTaggerType`, `VecTaggerCreate()`, `VecTaggerComputeIntervals()`
    959: S*/
    960: typedef struct {
    961:   PetscScalar min;
    962:   PetscScalar max;
    963: } VecTaggerBox;
    964: PETSC_EXTERN PetscErrorCode VecTaggerComputeBoxes(VecTagger, Vec, PetscInt *, VecTaggerBox *[], PetscBool *);

    966: PETSC_EXTERN PetscErrorCode VecTaggerAbsoluteSetBox(VecTagger, VecTaggerBox *);
    967: PETSC_EXTERN PetscErrorCode VecTaggerAbsoluteGetBox(VecTagger, const VecTaggerBox *[]);

    969: PETSC_EXTERN PetscErrorCode VecTaggerRelativeSetBox(VecTagger, VecTaggerBox *);
    970: PETSC_EXTERN PetscErrorCode VecTaggerRelativeGetBox(VecTagger, const VecTaggerBox *[]);

    972: PETSC_EXTERN PetscErrorCode VecTaggerCDFSetBox(VecTagger, VecTaggerBox *);
    973: PETSC_EXTERN PetscErrorCode VecTaggerCDFGetBox(VecTagger, const VecTaggerBox *[]);

    975: /*E
    976:   VecTaggerCDFMethod - Determines what method is used to compute absolute values from cumulative distribution values (e.g., what value is the preimage of .95 in the cdf).

    978:    Values:
    979: +  `VECTAGGER_CDF_GATHER`    - gather the data to MPI rank 0, perform the computation and broadcast the result
    980: -  `VECTAGGER_CDF_ITERATIVE` - compute the results on all ranks iteratively using `MPI_Allreduce()`

    982:   Level: advanced

    984:   Note:
    985:   Relevant only in parallel: in serial it is directly computed.

    987:   Developer Note:
    988:   In PETSc enums of this type are referred to with the term type, not method.

    990: .seealso: [](ch_vectors), `Vec`, `VecTagger`, `VecTaggerType`, `VecTaggerCreate()`, `VecTaggerCDFSetMethod()`
    991: E*/
    992: typedef enum {
    993:   VECTAGGER_CDF_GATHER,
    994:   VECTAGGER_CDF_ITERATIVE,
    995:   VECTAGGER_CDF_NUM_METHODS
    996: } VecTaggerCDFMethod;
    997: PETSC_EXTERN const char *const VecTaggerCDFMethods[];

    999: PETSC_EXTERN PetscErrorCode VecTaggerCDFSetMethod(VecTagger, VecTaggerCDFMethod);
    1000: PETSC_EXTERN PetscErrorCode VecTaggerCDFGetMethod(VecTagger, VecTaggerCDFMethod *);
    1001: PETSC_EXTERN PetscErrorCode VecTaggerCDFIterativeSetTolerances(VecTagger, PetscInt, PetscReal, PetscReal);
    1002: PETSC_EXTERN PetscErrorCode VecTaggerCDFIterativeGetTolerances(VecTagger, PetscInt *, PetscReal *, PetscReal *);

    1004: PETSC_EXTERN PetscErrorCode VecTaggerOrSetSubs(VecTagger, PetscInt, VecTagger *, PetscCopyMode);
    1005: PETSC_EXTERN PetscErrorCode VecTaggerOrGetSubs(VecTagger, PetscInt *, VecTagger *[]);

    1007: PETSC_EXTERN PetscErrorCode VecTaggerAndSetSubs(VecTagger, PetscInt, VecTagger *, PetscCopyMode);
    1008: PETSC_EXTERN PetscErrorCode VecTaggerAndGetSubs(VecTagger, PetscInt *, VecTagger *[]);

    1010: PETSC_EXTERN PetscErrorCode VecTaggerInitializePackage(void);
    1011: PETSC_EXTERN PetscErrorCode VecTaggerFinalizePackage(void);

    1013: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetVector(PetscViewer, Vec);
    1014: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetVector(PetscViewer, Vec);

    1016: PETSC_EXTERN PetscErrorCode VecFischer(Vec, Vec, Vec, Vec, Vec);
    1017: PETSC_EXTERN PetscErrorCode VecSFischer(Vec, Vec, Vec, Vec, PetscReal, Vec);

    1019: #if PetscDefined(USE_DEBUG)
    1020: /* This is an internal debug-only routine that should not be used by users */
    1021: PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode VecValidValues_Internal(Vec, PetscInt, PetscBool);
    1022: #else
    1023:   #define VecValidValues_Internal(...) PETSC_SUCCESS
    1024: #endif /* PETSC_USE_DEBUG */

    1026: #define VEC_CUPM_NOT_CONFIGURED(impl) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_SUP_SYS, "Must configure PETSc with " PetscStringize(impl) " support to use %s", PETSC_FUNCTION_NAME)

    1028: #if PetscDefined(HAVE_CUDA)
    1029:   #define VEC_CUDA_DECL_OR_STUB(__decl__, ...) PETSC_EXTERN __decl__;
    1030: #else
    1031:   #define VEC_CUDA_DECL_OR_STUB(__decl__, ...) \
    1032:     static inline __decl__ \
    1033:     { \
    1034:       __VA_ARGS__; \
    1035:       VEC_CUPM_NOT_CONFIGURED(cuda); \
    1036:     }
    1037: #endif /* PETSC_HAVE_CUDA */

    1039: /* extra underscore here to make it line up with the cuda versions */
    1040: #if PetscDefined(HAVE_HIP)
    1041:   #define VEC_HIP__DECL_OR_STUB(__decl__, ...) PETSC_EXTERN __decl__;
    1042: #else
    1043:   #define VEC_HIP__DECL_OR_STUB(__decl__, ...) \
    1044:     static inline __decl__ \
    1045:     { \
    1046:       __VA_ARGS__; \
    1047:       VEC_CUPM_NOT_CONFIGURED(hip); \
    1048:     }
    1049: #endif /* PETSC_HAVE_HIP */

    1051: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCreateSeqCUDA(MPI_Comm a, PetscInt b, Vec *c), (void)a, (void)b, (void)c)
    1052: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecCreateSeqHIP(MPI_Comm a, PetscInt b, Vec *c), (void)a, (void)b, (void)c)

    1054: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCreateSeqCUDAWithArray(MPI_Comm a, PetscInt b, PetscInt c, const PetscScalar *d, Vec *e), (void)a, (void)b, (void)c, (void)d, (void)e)
    1055: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecCreateSeqHIPWithArray(MPI_Comm a, PetscInt b, PetscInt c, const PetscScalar *d, Vec *e), (void)a, (void)b, (void)c, (void)d, (void)e)

    1057: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCreateSeqCUDAWithArrays(MPI_Comm a, PetscInt b, PetscInt c, const PetscScalar *d, const PetscScalar *e, Vec *f), (void)a, (void)b, (void)c, (void)d, (void)e, (void)f)
    1058: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecCreateSeqHIPWithArrays(MPI_Comm a, PetscInt b, PetscInt c, const PetscScalar *d, const PetscScalar *e, Vec *f), (void)a, (void)b, (void)c, (void)d, (void)e, (void)f)

    1060: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCreateMPICUDA(MPI_Comm a, PetscInt b, PetscInt c, Vec *d), (void)a, (void)b, (void)c, (void)d)
    1061: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecCreateMPIHIP(MPI_Comm a, PetscInt b, PetscInt c, Vec *d), (void)a, (void)b, (void)c, (void)d)

    1063: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCreateMPICUDAWithArray(MPI_Comm a, PetscInt b, PetscInt c, PetscInt d, const PetscScalar *e, Vec *f), (void)a, (void)b, (void)c, (void)d, (void)e, (void)f)
    1064: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecCreateMPIHIPWithArray(MPI_Comm a, PetscInt b, PetscInt c, PetscInt d, const PetscScalar *e, Vec *f), (void)a, (void)b, (void)c, (void)d, (void)e, (void)f)

    1066: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCreateMPICUDAWithArrays(MPI_Comm a, PetscInt b, PetscInt c, PetscInt d, const PetscScalar *e, const PetscScalar *f, Vec *g), (void)a, (void)b, (void)c, (void)d, (void)e, (void)f, (void)g)
    1067: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecCreateMPIHIPWithArrays(MPI_Comm a, PetscInt b, PetscInt c, PetscInt d, const PetscScalar *e, const PetscScalar *f, Vec *g), (void)a, (void)b, (void)c, (void)d, (void)e, (void)f, (void)g)

    1069: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDAGetArray(Vec a, PetscScalar **b), (void)a, (void)b)
    1070: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPGetArray(Vec a, PetscScalar **b), (void)a, (void)b)

    1072: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDARestoreArray(Vec a, PetscScalar **b), (void)a, (void)b)
    1073: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPRestoreArray(Vec a, PetscScalar **b), (void)a, (void)b)

    1075: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDAGetArrayRead(Vec a, const PetscScalar **b), (void)a, (void)b)
    1076: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPGetArrayRead(Vec a, const PetscScalar **b), (void)a, (void)b)

    1078: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDARestoreArrayRead(Vec a, const PetscScalar **b), (void)a, (void)b)
    1079: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPRestoreArrayRead(Vec a, const PetscScalar **b), (void)a, (void)b)

    1081: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDAGetArrayWrite(Vec a, PetscScalar **b), (void)a, (void)b)
    1082: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPGetArrayWrite(Vec a, PetscScalar **b), (void)a, (void)b)

    1084: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDARestoreArrayWrite(Vec a, PetscScalar **b), (void)a, (void)b)
    1085: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPRestoreArrayWrite(Vec a, PetscScalar **b), (void)a, (void)b)

    1087: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDAPlaceArray(Vec a, const PetscScalar b[]), (void)a, (void)b)
    1088: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPPlaceArray(Vec a, const PetscScalar b[]), (void)a, (void)b)

    1090: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDAReplaceArray(Vec a, const PetscScalar b[]), (void)a, (void)b)
    1091: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPReplaceArray(Vec a, const PetscScalar b[]), (void)a, (void)b)

    1093: VEC_CUDA_DECL_OR_STUB(PetscErrorCode VecCUDAResetArray(Vec a), (void)a)
    1094: VEC_HIP__DECL_OR_STUB(PetscErrorCode VecHIPResetArray(Vec a), (void)a)

    1096: #undef VEC_CUPM_NOT_CONFIGURED
    1097: #undef VEC_CUDA_DECL_OR_STUB
    1098: #undef VEC_HIP__DECL_OR_STUB