Actual source code: petscbag.h
petsc-3.6.1 2015-08-06
4: #include <petscsys.h>
6: /*S
7: PetscBag - PETSc object that manages a collection of user data including parameters.
8: A bag is essentially a C struct with serialization (you can save it and load it from files).
10: Level: beginner
12: Sample Usage:
13: $ typedef struct {
14: $ PetscInt height;
15: $ PetscScalar root;
16: $ PetscReal byebye;
17: $ } MyParameters;
18: $
19: $ PetscBag bag;
20: $ MyParameters *params;
21: $
22: $ PetscBagCreate(PETSC_COMM_WORLD,sizeof(MyParameters),&bag);
23: $ PetscBagGetData(bag,(void **)¶ms);
24: $ PetscBagSetName(bag,"MyParameters");
25: $ PetscBagRegisterInt(bag,¶ms.height,22,"height","Height of the water tower");
26: $
28: .seealso: PetscBagSetName(), PetscBagGetName(), PetscBagView(), PetscBagLoad(), PetscBagGetData()
29: PetscBagRegisterReal(), PetscBagRegisterInt(), PetscBagRegisterBool(), PetscBagRegisterScalar()
30: PetscBagSetFromOptions(), PetscBagRegisterVec(), PetscBagCreate(), PetscBagDestroy(), PetscBagRegisterEnum()
31: S*/
32: typedef struct _n_PetscBag* PetscBag;
33: typedef struct _n_PetscBagItem* PetscBagItem;
35: PETSC_EXTERN PetscErrorCode PetscBagCreate(MPI_Comm,size_t,PetscBag*);
36: PETSC_EXTERN PetscErrorCode PetscBagDestroy(PetscBag*);
37: PETSC_EXTERN PetscErrorCode PetscBagGetData(PetscBag,void **);
38: PETSC_EXTERN PetscErrorCode PetscBagRegisterReal(PetscBag,void*,PetscReal, const char*, const char*);
39: PETSC_EXTERN PetscErrorCode PetscBagRegisterRealArray(PetscBag,void*,PetscInt, const char*, const char*);
40: PETSC_EXTERN PetscErrorCode PetscBagRegisterString(PetscBag,void*,PetscInt,const char*, const char*, const char*);
41: PETSC_EXTERN PetscErrorCode PetscBagRegisterScalar(PetscBag,void*,PetscScalar,const char*,const char*);
42: PETSC_EXTERN PetscErrorCode PetscBagRegisterInt(PetscBag,void*,PetscInt,const char*,const char*);
43: PETSC_EXTERN PetscErrorCode PetscBagRegister64bitInt(PetscBag,void*,Petsc64bitInt,const char*,const char*);
44: PETSC_EXTERN PetscErrorCode PetscBagRegisterIntArray(PetscBag,void*,PetscInt,const char*,const char*);
45: PETSC_EXTERN PetscErrorCode PetscBagRegisterEnum(PetscBag,void*,const char*const*,PetscEnum,const char*,const char*);
46: PETSC_EXTERN PetscErrorCode PetscBagRegisterBool(PetscBag,void*,PetscBool ,const char*,const char*);
47: PETSC_EXTERN PetscErrorCode PetscBagRegisterBoolArray(PetscBag,void*,PetscInt,const char*,const char*);
48: PETSC_EXTERN PetscErrorCode PetscBagGetNames(PetscBag, const char *[]);
50: PETSC_EXTERN PetscErrorCode PetscBagSetFromOptions(PetscBag);
51: PETSC_EXTERN PetscErrorCode PetscBagGetName(PetscBag, char **);
52: PETSC_EXTERN PetscErrorCode PetscBagSetName(PetscBag, const char *, const char *);
53: PETSC_EXTERN PetscErrorCode PetscBagSetOptionsPrefix(PetscBag, const char *);
55: PETSC_EXTERN PetscErrorCode PetscBagView(PetscBag,PetscViewer);
56: PETSC_EXTERN PetscErrorCode PetscBagLoad(PetscViewer,PetscBag);
58: PETSC_EXTERN PetscErrorCode PetscBagSetViewer(PetscBag,PetscErrorCode (*)(PetscBag,PetscViewer));
59: PETSC_EXTERN PetscErrorCode PetscBagSetLoader(PetscBag,PetscErrorCode (*)(PetscBag,PetscViewer));
60: PETSC_EXTERN PetscErrorCode PetscBagSetDestroy(PetscBag,PetscErrorCode (*)(PetscBag));
62: #define PETSC_BAG_FILE_CLASSID 1211219
64: #endif