petsc-3.14.6 2021-03-30
Report Typos and Errors

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 _n_PetscBag*     PetscBag;

Sample Usage

     typedef struct {
        PetscInt     height;
        PetscScalar  root;
        PetscReal    byebye;
     } MyParameters;

     PetscBag     bag;
     MyParameters *params;

     ierr = PetscBagCreate(PETSC_COMM_WORLD,sizeof(MyParameters),&bag);CHKERRQ(ierr);
     ierr = PetscBagGetData(bag,(void **)&params);CHKERRQ(ierr);
     ierr = PetscBagSetName(bag,"MyParameters");CHKERRQ(ierr);
     ierr = PetscBagRegisterInt(bag,&params.height,22,"height","Height of the water tower");CHKERRQ(ierr);

See Also

PetscBagSetName(), PetscBagGetName(), PetscBagView(), PetscBagLoad(), PetscBagGetData()
PetscBagRegisterReal(), PetscBagRegisterInt(), PetscBagRegisterBool(), PetscBagRegisterScalar() PetscBagSetFromOptions(), PetscBagRegisterVec(), PetscBagCreate(), PetscBagDestroy(), PetscBagRegisterEnum()

Level

beginner

Location

src/sys/classes/bag/../../../../include/petscbag.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages