[petsc-users] question about DA

Jed Brown jedbrown at mcs.anl.gov
Sat Aug 27 15:14:55 CDT 2011


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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110827/c48335d0/attachment.htm>


More information about the petsc-users mailing list