[petsc-users] Storing an array in a PetscBag
Barry Smith
bsmith at mcs.anl.gov
Fri Sep 10 13:44:29 CDT 2010
We have always thought about bags as containing only very small, fixed amounts of data so no there is no mechanism to put in variable sized arrays. I hesitate to say we should add all that support and make it the bag such a complicated object.
Barry
On Sep 10, 2010, at 11:27 AM, Blaise Bourdin wrote:
> 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