:orphan: # DMStagVecSplitToDMDA create a `DMDA` and `Vec` from a subgrid of a `DMSTAG` and its `Vec` ## Synopsis ``` PetscErrorCode DMStagVecSplitToDMDA(DM dm, Vec vec, DMStagStencilLocation loc, PetscInt c, DM *pda, Vec *pdavec) ``` Collective ## Input Parameters - ***dm -*** the `DMSTAG` object - ***vec-*** Vec object associated with `dm` - ***loc -*** which subgrid to extract (see `DMStagStencilLocation`) - ***c -*** which component to extract (see note below) ## Output Parameters - ***pda -*** the `DMDA` - ***pdavec -*** the new `Vec` ## Notes If a `c` value of `-k` is provided, the first `k` DOF for that position are extracted, padding with zero values if needed. If a non-negative value is provided, a single DOF is extracted. The caller is responsible for destroying the created `DMDA` and `Vec`. ## See Also [](ch_stag), `DMSTAG`, `DMDA`, `DMStagStencilLocation`, `DM`, `Vec`, `DMStagMigrateVec()`, `DMStagCreateCompatibleDMStag()` ## Level advanced ## Location src/dm/impls/stag/stagda.c ## Examples src/dm/impls/stag/tutorials/ex4.c
src/dm/impls/stag/tutorials/ex6.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/stag/stagda.c) [Index of all DMStag routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)