[petsc-users] Storing an array in a PetscBag

Blaise Bourdin bourdin at lsu.edu
Fri Sep 10 11:27:01 CDT 2010


Hi,

Is there an easy way to use PetscBag to manage arrays of user data?
optimally, I would like to something like
typedef struct {
	PetscInt  n;
	PetscReal *values;
} MyParameters;
MyParameters   *params

and be able to register "values" in the bag so that I can specify its values as
-n 3 -values 1.,2.,3. or -n 2 -values 1.,2.

Right now, I can see how I can get n prior to creating the bag and register params->values[0] to params->values[n-1] so that the command line could become -n 3 -values0 1 -values1 2 -values2 3 or -n 2 -values0 1 -values1 2

Would that require adding PetscBagRegisterXXXArray function or is it feasible in the current implementation?

Blaise 

-- 
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin









More information about the petsc-users mailing list