Skip to main content
`Ctrl`+`K`

# PetscBagGetData

Gives back the user - access to memory that can be used for storing user-data-structure

## Synopsis

    #include "petscbag.h"
    PetscErrorCode PetscBagGetData(PetscBag bag, PetscCtxRt data)

Not Collective

## Input Parameter

- bag - the bag of values

## Output Parameter

- data - pointer to memory that will have user-data-structure, this can be cast to a pointer of the type the C struct used in defining the bag

## See Also

`PetscBag`, `PetscBagSetName()`, `PetscBagView()`, `PetscBagLoad()`, `PetscBagRegisterReal()`, `PetscBagRegisterInt()`, `PetscBagRegisterBool()`, `PetscBagRegisterScalar()`, `PetscBagSetFromOptions()`, `PetscBagCreate()`, `PetscBagDestroy()`, `PetscBagRegisterEnum()`

## Level

intermediate

## Location

src/sys/classes/bag/bag.c

## Examples

src/dm/tutorials/ex7.c
src/snes/tutorials/ex27.c
src/snes/tutorials/ex71.c
src/sys/tutorials/ex5.c
src/snes/tutorials/ex76.c
src/snes/tutorials/ex36.c
src/snes/tutorials/ex34.c
src/snes/tutorials/ex62.c
src/snes/tutorials/ex69.c
src/snes/tutorials/ex17.c

Index of all Bag routines
Table of Contents for all manual pages
Index of all manual pages