[petsc-users] question about DA

Likun Tan likunt at andrew.cmu.edu
Sat Aug 27 15:24:11 CDT 2011



g(temp) could be sum of temp[num][j][i] where num from 1 to N, so the
index k is specified.

On Sat, August 27, 2011 4:14 pm, Jed Brown wrote:
> On Sat, Aug 27, 2011 at 15:10, Likun Tan <likunt at andrew.cmu.edu> wrote:
>
>
>> DAGetCorners(da2D, &xs, &ys, 0, &m, &n, 0);
>> DAVecGetArray(da2D, VS, &S);
>> for(j=ys; j<ys+n; j++)  { for(i=xs; i<xs+m; i++)  { S[j][i]=g(temp);
>> //function evalution
>>
>>
>
> How does the function g know how to index temp[k][j][i]? I.e. how does it
>  get access to those variables? Is it a macro instead of a function? Note
>  that the value of k is stale here because it will be equal to zs+p.
>
>
>> }
>> }
>>
>>
>> f(temp) and g(temp) are functions of temp[k][j][i], when i assigned
>> values to H, there is no error; while when setting values to S using
>> temp, it gives errors, if using f(i,j,k) to assign values to S, it works
>> fine.
>>
>






More information about the petsc-users mailing list