# PetscBag

PETSc object that manages a collection of user data including parameters. A bag is essentially a C struct with serialization (you can save it and load it from files).

### Synopsis

    typedef struct {
      MPI_Comm     bagcomm;
      PetscInt     bagsize;
      PetscInt     count;
      char         bagname[PETSC_BAG_NAME_LENGTH];
      char         baghelp[PETSC_BAG_HELP_LENGTH];
      PetscBagItem bagitems;
    } PetscBag;

### Sample Usage

         typedef struct {

            PetscBag     bag;

            PetscInt     height;

            PetscScalar  root;

            PetscReal    byebye;

         } MyParameters;

         MyParameters *params;

          $      ierr = PetscBagCreate(MyParameters,&params);

         ierr = PetscBagSetName(params,"MyParameters");

         ierr = PetscBagRegisterInt(params,&params.height,22,"height","Height of the water tower");

           $

           $

            .seealso:  PetscBagSetName(), PetscBagGetName(), PetscBagView(), PetscBagLoad()

PetscBagRegisterReal(), PetscBagRegisterInt(), PetscBagRegisterTruth(), PetscBagRegisterScalar() PetscBagSetFromOptions(), PetscBagRegisterVec(), PetscBagCreate(), PetscBagDestroy(), PetscBagRegisterEnum()

Level:beginner
Location:include/petscbag.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages