# DMPlexGlobalVectorView
Saves a global vector 
## Synopsis
```
#include "petscdmplex.h"   
PetscErrorCode DMPlexGlobalVectorView(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 global section on which vec is defined
- ***vec       -*** The global vector to be saved





## Notes
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);
```
```none
DMSetType(dm, DMPLEX);
```
```none
PetscObjectSetName((PetscObject)dm, "topologydm_name");
```
```none
DMClone(dm, &sectiondm);
```
```none
PetscObjectSetName((PetscObject)sectiondm, "sectiondm_name");
```
```none
PetscSectionCreate(PETSC_COMM_WORLD, &section);
```
```none
DMPlexGetChart(sectiondm, &pStart, &pEnd);
```
```none
PetscSectionSetChart(section, pStart, pEnd);
```
```none
PetscSectionSetUp(section);
```
```none
DMSetLocalSection(sectiondm, section);
```
```none
PetscSectionDestroy(&section);
```
```none
DMGetGlobalVector(sectiondm, &vec);
```
```none
PetscObjectSetName((PetscObject)vec, "vec_name");
```
```none
DMPlexTopologyView(dm, viewer);
```
```none
DMPlexSectionView(dm, viewer, sectiondm);
```
```none
DMPlexGlobalVectorView(dm, viewer, sectiondm, vec);
```
```none
DMRestoreGlobalVector(sectiondm, &vec);
```
```none
DMDestroy(&sectiondm);
```
```none
DMDestroy(&dm);
```


## See Also
 `DMPlexTopologyView()`, `DMPlexSectionView()`, `DMPlexLocalVectorView()`, `DMPlexGlobalVectorLoad()`, `DMPlexLocalVectorLoad()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plex.c.html#DMPlexGlobalVectorView">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)  
