[petsc-users] updating values in a DA Global array

Jed Brown jed at 59A2.org
Wed Jun 23 04:01:33 CDT 2010


On Tue, 22 Jun 2010 23:35:08 -0500, Barry Smith <bsmith at mcs.anl.gov> wrote:
>    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.

Is it possible to declare the bounds when you declare the pointer?  Even
if that worked, it's not clearly less awkward than using a separate
local function, which is not completely unreasonable.  Slightly awkward
to work with, but it does direct addressing which we can't do for
multi-dimensional non-0-based arrays in C (C99 offers direct indexing
for runtime-dimensioned 0-based arrays).

Jed


More information about the petsc-users mailing list