fortran interface for MatCreateSeqAIJWithArrays
tsjb00
tsjb00 at hotmail.com
Mon Aug 24 16:19:09 CDT 2009
Hi, there!
I have a quick question on the Fortran interface of MatCreateSeqAIJWithArrays.
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?
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:
for (k=zs; k<zs+zm; k++) {
for (j=ys; j<ys+ym; j++) {
for (i=xs; i<xs+xm; i++) {
for (idof=0;idof<dof;idof++){
X_a[k][j][i][idof]=.............
...............................................
}
}
}
}
If in Fortran, how should the loop be structured? Please check if the following is right.
do k=zs,zs+zm
do j=ys,ys+ym
do i=xs,xs+xm
do iof=1,dof
X_a(iof,i,j,k)=..............
enddo
.............
Many thanks in advance!
_________________________________________________________________
Messenger安全保护中心,免费修复系统漏洞,保护Messenger安全!
http://im.live.cn/safe/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090824/e0f6244b/attachment.htm>
More information about the petsc-users
mailing list