<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi, there!<br><br>I have a quick question on the Fortran interface of MatCreateSeqAIJWithArrays. <br><br>The documentation indicates 'The i and j indices are 0 based'. Is it so when called in Fortran? Should the array be 0 based too? Any precautions to be taken to avoid segmentation error?<br><br>Another question is about the storage of vector/arrays when using Fortran. In the PETSc examples, say a vector X_v is created using DACreateXXXVector, then the values are accessed with array X_a using DAVecGetArray. To access individual value, the loop is coded as:<br> for (k=zs; k<zs+zm; k++) {<br> for (j=ys; j<ys+ym; j++) {<br> for (i=xs; i<xs+xm; i++) {<br> for (idof=0;idof<dof;idof++){<br> X_a[k][j][i][idof]=.............<br>...............................................<br> }<br> }<br> }<br> }<br>If in Fortran, how should the loop be structured? Please check if the following is right.<br> do k=zs,zs+zm<br> do j=ys,ys+ym<br> do i=xs,xs+xm<br> do iof=1,dof<br> X_a(iof,i,j,k)=..............<br> enddo<br>.............<br><br><br>Many thanks in advance!<br /><hr />使用新一代 Windows Live Messenger 轻松交流和共享! <a href='http://www.windowslive.cn/Messenger/' target='_new'>立刻下载!</a></body>
</html>