# DMPlexLocalVectorView
Saves a local vector 
## Synopsis
```
#include "petscdmplex.h"   
PetscErrorCode DMPlexLocalVectorView(DM dm, PetscViewer viewer, DM sectiondm, Vec vec)
```
Collective on dm


## Input Parameters

- ***dm        -*** The `DM` that represents the topology
- ***viewer    -*** The `PetscViewer` to save data with
- ***sectiondm -*** The `DM` that contains the local section on which vec is defined; may be the same as dm
- ***vec       -*** The local vector to be saved





## Note
In general dm and sectiondm are two different objects, the former carrying the topology and the latter carrying the section, and have been given a topology name and a section name, respectively, with `PetscObjectSetName()`. In practice, however, they can be the same object if it carries both topology and section; in that case the name of the object is used as both the topology name and the section name.


## Typical calling sequence
```none
       DMCreate(PETSC_COMM_WORLD, &dm);
       DMSetType(dm, DMPLEX);
       PetscObjectSetName((PetscObject)dm, "topologydm_name");
       DMClone(dm, &sectiondm);
       PetscObjectSetName((PetscObject)sectiondm, "sectiondm_name");
       PetscSectionCreate(PETSC_COMM_WORLD, &section);
       DMPlexGetChart(sectiondm, &pStart, &pEnd);
       PetscSectionSetChart(section, pStart, pEnd);
       PetscSectionSetUp(section);
       DMSetLocalSection(sectiondm, section);
       DMGetLocalVector(sectiondm, &vec);
       PetscObjectSetName((PetscObject)vec, "vec_name");
       DMPlexTopologyView(dm, viewer);
       DMPlexSectionView(dm, viewer, sectiondm);
       DMPlexLocalVectorView(dm, viewer, sectiondm, vec);
       DMRestoreLocalVector(sectiondm, &vec);
       DMDestroy(&sectiondm);
       DMDestroy(&dm);
```



## See Also
 [](chapter_unstructured), `DM`, `DMPLEX`, `DMPlexTopologyView()`, `DMPlexSectionView()`, `DMPlexGlobalVectorView()`, `DMPlexGlobalVectorLoad()`, `DMPlexLocalVectorLoad()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plex.c.html#DMPlexLocalVectorView">src/dm/impls/plex/plex.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/plex/plex.c)


[Index of all DMPlex routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
