<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16535"><LINK rel=stylesheet
href="BLOCKQUOTE{margin-Top: 0px; margin-Bottom: 0px; margin-Left: 2em}"></HEAD>
<BODY style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<DIV><FONT color=#0000ff size=3 face=Verdana>petsc teams,</FONT></DIV>
<DIV><FONT color=#0000ff size=3></FONT> </DIV>
<DIV><FONT color=#0000ff size=3>if I want create the relation between u() <FONT
color=#333333>[array]</FONT> and x <FONT color=#333333>[Vec] ,</FONT><FONT
color=#0000ff>I can do it as follows,</FONT></FONT></DIV>
<DIV><FONT color=#333333 size=3></FONT> </DIV>
<DIV><FONT color=#ff6600 size=3 face=Verdana><FONT
size=2>#define u(ib) xx_v(xx_i + (ib))</FONT>
</FONT></DIV>
<DIV>
<DIV><FONT color=#ff6600>
call VecGetArray(x,xx_v,xx_i,ierr)</FONT></DIV>
<DIV><FONT
color=#ff6600> do 30 i=1,n</FONT></DIV>
<DIV><FONT
color=#ff6600> u(i) = 1000.0*i</FONT></DIV>
<DIV><FONT color=#ff6600> 30 continue</FONT></DIV>
<DIV><FONT color=#ff6600></FONT></DIV>
<DIV><FONT
color=#ff6600> call VecRestoreArray(x,xx_v,xx_i,ierr)</FONT></DIV>
<DIV><FONT color=#ff6600></FONT> </DIV></DIV>
<DIV><FONT color=#0000ff size=3 face=Verdana>However, I don't understand
why can not I do it as follows,</FONT></DIV>
<DIV><FONT color=#0000ff size=3></FONT> </DIV>
<DIV><FONT color=#0000ff size=3><FONT
color=#000000> </FONT><FONT color=#ff6600
size=2>double precision u(1) <FONT color=#000000>or
u(6)</FONT></FONT></FONT></DIV>
<DIV><FONT color=#0000ff size=3><FONT color=#ff6600
size=2>
call VecGetArray(x,u,xx_i,ierr)</FONT></DIV>
<DIV><FONT color=#ff6600
size=2> do 30 i=1,n</FONT></DIV>
<DIV><FONT color=#ff6600
size=2> u(i) = 1000.0*i</FONT></DIV>
<DIV><FONT color=#ff6600
size=2> 30 continue</FONT></DIV>
<DIV><FONT color=#ff6600 size=2></FONT></DIV>
<DIV><FONT color=#ff6600
size=2> call VecRestoreArray(x,u,xx_i,ierr)</FONT></DIV>
<DIV><FONT color=#ff6600 size=2></FONT> </DIV></FONT>
<DIV align=left><FONT color=#0000ff size=3 face=Verdana> Why u() must be
created by #define, and u() cannot be defined again,for example "double
precision u(1)" or u(5).</FONT></DIV>
<DIV align=left><FONT color=#0000ff size=3 face=Verdana></FONT> </DIV>
<DIV align=left><FONT color=#0000ff size=3 face=Verdana><SPAN>By the way, if u()
is a array of common blocks<FONT color=#000000>(fortran),</FONT> how can I
create the relation between u() and x?</SPAN></FONT></DIV>
<DIV align=left><FONT color=#0000ff size=3
face=Verdana><SPAN></SPAN></FONT> </DIV>
<DIV align=left><FONT color=#0000ff size=3 face=Verdana><SPAN>thanks,</DIV>
<DIV align=left>
<DIV><FONT size=2 face=Verdana></FONT><FONT color=#0000ff size=3
face=华文行楷></FONT> </DIV>
<DIV><FONT face=华文行楷>Leping</FONT> </DIV></DIV></SPAN></FONT><FONT size=2
face=Verdana><FONT color=#0000ff size=3>
<HR style="WIDTH: 122px; HEIGHT: 2px" align=left SIZE=2>
</FONT>
<DIV><FONT color=#0000ff size=3 face=Verdana> 2010-04-16</FONT></DIV>
<DIV> </DIV></FONT></BODY></HTML>