Gideon Simpson <[email protected]> writes:

> How would that work?  I took Jed's advice, and set it up so that I have 
> access via:
>
> realization_array[ realization_dof * i + 1 +j] = jth point of ith realization
>
> and then I further used a pointer:
>
> PetscScalar *x;
>
> x = & realization_array[ realization_dof * i + 1];
>
> so that I have "clean" access to the elements of each realization through 
> x[j].

DMDAVecGetArrayDOF sets up one extra level of pointer indirection.  You
can't have the reserved member "id" that way, but you can use a syntax
closer to what you suggested.

  PetscScalar **realization_array;

  DMDAVecGetArrayDOF(sim_data_da, sim_data_vec, &realization_array);

    realization_array[i][j] = 1.234;

Attachment: pgp5MShsIwZai.pgp
Description: PGP signature

Reply via email to