:orphan:
# PetscBagLoad
Loads a bag of values from a binary file
## Synopsis
```
#include "petscbag.h"
PetscErrorCode PetscBagLoad(PetscViewer view, PetscBag bag)
```
Collective
## Input Parameters
- ***viewer -*** file to load values from
- ***bag -*** the bag of values
## Note
You must have created and registered all the fields in the bag before loading into it. This only loads values.
## See Also
`PetscBag`, `PetscBagSetName()`, `PetscBagDestroy()`, `PetscBagView()`, `PetscBagGetData()`
`PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()`
`PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagGetName()`, `PetscBagRegisterEnum()`
## Level
beginner
## Location
src/sys/classes/bag/bag.c
## Examples
src/sys/tutorials/ex5.c
src/sys/tutorials/ex5f90.F90
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/bag/bag.c)
[Index of all Sys routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)