:orphan:
# DMNetworkGetGlobalVecOffset
Get the global offset for accessing the variables associated with a component for the given vertex/edge from the global vector 
## Synopsis
```
#include "petscdmnetwork.h"  
PetscErrorCode DMNetworkGetGlobalVecOffset(DM dm, PetscInt p, PetscInt compnum, PetscInt *offsetg)
```
Not Collective


## Input Parameters

- ***dm -*** the `DMNETWORK` object
- ***p -*** the edge or vertex point
- ***compnum -*** component number; use ALL_COMPONENTS if no specific component is requested



## Output Parameter

- ***offsetg -*** the global offset





## Notes
These offsets can be passed to `MatSetValues()` for matrices obtained with `DMCreateMatrix()`.

For vectors obtained with `DMCreateGlobalVector()` the offsets can be used with `VecSetValues()`.

For vectors obtained with `DMCreateGlobalVector()` and the array obtained with `VecGetArray`(vec,&array) you can access or set
the vector values with array[offset - rstart] where restart is obtained with `VecGetOwnershipRange`(v,&rstart,`NULL`);


## See Also
 `DM`, `DMNETWORK`, `DMNetworkGetLocalVecOffset()`, `DMGetGlobalVector()`, `DMNetworkGetComponent()`, `DMCreateGlobalVector()`, `VecGetArray()`, `VecSetValues()`, `MatSetValues()`

## Level
intermediate

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


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


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