[petsc-users] updating values in a DA Global array
Barry Smith
bsmith at mcs.anl.gov
Tue Jun 22 23:35:08 CDT 2010
On Jun 22, 2010, at 6:36 PM, Barry Smith wrote:
>
> On Jun 22, 2010, at 6:32 PM, Jed Brown wrote:
>
>> On Tue, 22 Jun 2010 23:21:11 +0000, Matthew Knepley <knepley at gmail.com> wrote:
>>> That should work.
>>
>> I thought *GetArrayF90 requires you have to call a "local function" for
>> multidimensional arrays, as in snes ex5f90.F.
>
> VecGetArrayF90 requires 1d array (since Vec has no concept of multi-dimension)
>
>> If you declare the
>> pointer as multi-dimensional, you get errors about shape-matching rules,
>> if you try to use a usual pointer (1D) you get errors about incorrect
>> subscripting. Is there a workaround, or do you always need to call the
>> local version to get it to type-check?
>
> In theory someone could take the energy to finish the DAVecGetArrayF90() for 2 and 3 dimensions and get what is needed. In practice the only people who know enough to finish it despise Fortran so much you need to bash them on the head to get it done (and that includes me). See my other email for directions.
>
Looking at this more closely and trying to do it, I think it may not be possible in F90. You don't seem to be able to set the range of indices in the ptr array (it seems it must always be 1:somevalue) so we can't do the trick we do in C and F77 of embedding a smaller 2d array inside an imaginary larger array and accessing values out of the smaller array by using indices of the larger array.
Barry
> Barry
>
>>
>> Jed
>
More information about the petsc-users
mailing list