[petsc-users] updating values in a DA Global array
Barry Smith
bsmith at mcs.anl.gov
Wed Jun 23 09:16:59 CDT 2010
On Jun 23, 2010, at 4:01 AM, Jed Brown wrote:
> 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?
I cannot find any F90 syntax that allows that.
Barry
> 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